From 34ae0d48e9669687003c26f94e07fa00d12dd41f Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Mon, 6 Sep 2021 13:38:00 -0700 Subject: Add tests for char/wchar_t signedness --- test/char-sign+aarch64.c | 4 ++++ test/char-sign+aarch64.qbe | 10 ++++++++++ test/char-sign+riscv64.c | 4 ++++ test/char-sign+riscv64.qbe | 10 ++++++++++ test/char-sign+x86_64.c | 4 ++++ test/char-sign+x86_64.qbe | 10 ++++++++++ test/wchar-sign+aarch64.c | 4 ++++ test/wchar-sign+aarch64.qbe | 9 +++++++++ test/wchar-sign+riscv64.c | 4 ++++ test/wchar-sign+riscv64.qbe | 9 +++++++++ test/wchar-sign+x86_64.c | 4 ++++ test/wchar-sign+x86_64.qbe | 9 +++++++++ 12 files changed, 81 insertions(+) create mode 100644 test/char-sign+aarch64.c create mode 100644 test/char-sign+aarch64.qbe create mode 100644 test/char-sign+riscv64.c create mode 100644 test/char-sign+riscv64.qbe create mode 100644 test/char-sign+x86_64.c create mode 100644 test/char-sign+x86_64.qbe create mode 100644 test/wchar-sign+aarch64.c create mode 100644 test/wchar-sign+aarch64.qbe create mode 100644 test/wchar-sign+riscv64.c create mode 100644 test/wchar-sign+riscv64.qbe create mode 100644 test/wchar-sign+x86_64.c create mode 100644 test/wchar-sign+x86_64.qbe (limited to 'test') diff --git a/test/char-sign+aarch64.c b/test/char-sign+aarch64.c new file mode 100644 index 0000000..84d35ee --- /dev/null +++ b/test/char-sign+aarch64.c @@ -0,0 +1,4 @@ +int x = (char)-1 < 0; +int main(void) { + return (char)-1 < 0; +} diff --git a/test/char-sign+aarch64.qbe b/test/char-sign+aarch64.qbe new file mode 100644 index 0000000..002f645 --- /dev/null +++ b/test/char-sign+aarch64.qbe @@ -0,0 +1,10 @@ +export data $x = align 4 { w 0, } +export +function w $main() { +@start.1 +@body.2 + %.1 =w sub 0, 1 + %.2 =w extub %.1 + %.3 =w csltw %.2, 0 + ret %.3 +} diff --git a/test/char-sign+riscv64.c b/test/char-sign+riscv64.c new file mode 100644 index 0000000..84d35ee --- /dev/null +++ b/test/char-sign+riscv64.c @@ -0,0 +1,4 @@ +int x = (char)-1 < 0; +int main(void) { + return (char)-1 < 0; +} diff --git a/test/char-sign+riscv64.qbe b/test/char-sign+riscv64.qbe new file mode 100644 index 0000000..002f645 --- /dev/null +++ b/test/char-sign+riscv64.qbe @@ -0,0 +1,10 @@ +export data $x = align 4 { w 0, } +export +function w $main() { +@start.1 +@body.2 + %.1 =w sub 0, 1 + %.2 =w extub %.1 + %.3 =w csltw %.2, 0 + ret %.3 +} diff --git a/test/char-sign+x86_64.c b/test/char-sign+x86_64.c new file mode 100644 index 0000000..1dae89b --- /dev/null +++ b/test/char-sign+x86_64.c @@ -0,0 +1,4 @@ +int x = (char)-1 > 0; +int main(void) { + return (char)-1 > 0; +} diff --git a/test/char-sign+x86_64.qbe b/test/char-sign+x86_64.qbe new file mode 100644 index 0000000..0e44442 --- /dev/null +++ b/test/char-sign+x86_64.qbe @@ -0,0 +1,10 @@ +export data $x = align 4 { w 0, } +export +function w $main() { +@start.1 +@body.2 + %.1 =w sub 0, 1 + %.2 =w extsb %.1 + %.3 =w csgtw %.2, 0 + ret %.3 +} diff --git a/test/wchar-sign+aarch64.c b/test/wchar-sign+aarch64.c new file mode 100644 index 0000000..605cfb5 --- /dev/null +++ b/test/wchar-sign+aarch64.c @@ -0,0 +1,4 @@ +int x = -L'\001' < 0; +int main(void) { + return -L'\001' < 0; +} diff --git a/test/wchar-sign+aarch64.qbe b/test/wchar-sign+aarch64.qbe new file mode 100644 index 0000000..c81124d --- /dev/null +++ b/test/wchar-sign+aarch64.qbe @@ -0,0 +1,9 @@ +export data $x = align 4 { w 0, } +export +function w $main() { +@start.1 +@body.2 + %.1 =w sub 0, 1 + %.2 =w cultw %.1, 0 + ret %.2 +} diff --git a/test/wchar-sign+riscv64.c b/test/wchar-sign+riscv64.c new file mode 100644 index 0000000..2edb6e4 --- /dev/null +++ b/test/wchar-sign+riscv64.c @@ -0,0 +1,4 @@ +int x = -L'\001' > 0; +int main(void) { + return -L'\001' > 0; +} diff --git a/test/wchar-sign+riscv64.qbe b/test/wchar-sign+riscv64.qbe new file mode 100644 index 0000000..8f84971 --- /dev/null +++ b/test/wchar-sign+riscv64.qbe @@ -0,0 +1,9 @@ +export data $x = align 4 { w 0, } +export +function w $main() { +@start.1 +@body.2 + %.1 =w sub 0, 1 + %.2 =w csgtw %.1, 0 + ret %.2 +} diff --git a/test/wchar-sign+x86_64.c b/test/wchar-sign+x86_64.c new file mode 100644 index 0000000..2edb6e4 --- /dev/null +++ b/test/wchar-sign+x86_64.c @@ -0,0 +1,4 @@ +int x = -L'\001' > 0; +int main(void) { + return -L'\001' > 0; +} diff --git a/test/wchar-sign+x86_64.qbe b/test/wchar-sign+x86_64.qbe new file mode 100644 index 0000000..8f84971 --- /dev/null +++ b/test/wchar-sign+x86_64.qbe @@ -0,0 +1,9 @@ +export data $x = align 4 { w 0, } +export +function w $main() { +@start.1 +@body.2 + %.1 =w sub 0, 1 + %.2 =w csgtw %.1, 0 + ret %.2 +} -- cgit v1.2.3