aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2022-02-10 15:41:35 -0800
committerMichael Forney <mforney@mforney.org>2022-02-10 15:41:35 -0800
commitf57f61b49c05c6705da909c9c29172ea3602bdee (patch)
treea6cb079bd691994490e0eb7241abfc812c40f11c
parent28fdb0f046184e567e85b9bb40dc942ca1739d9f (diff)
qbe: Use new unary negation operator
-rw-r--r--test/bitfield-assignment-sign-extend.qbe2
-rw-r--r--test/bitfield-integer-promotion.qbe2
-rw-r--r--test/char-sign+aarch64.qbe2
-rw-r--r--test/char-sign+riscv64.qbe2
-rw-r--r--test/char-sign+x86_64.qbe2
-rw-r--r--test/common-real-int-sign.qbe2
-rw-r--r--test/expr-neg.c3
-rw-r--r--test/expr-neg.qbe10
-rw-r--r--test/wchar-sign+aarch64.qbe2
-rw-r--r--test/wchar-sign+riscv64.qbe2
-rw-r--r--test/wchar-sign+x86_64.qbe2
11 files changed, 22 insertions, 9 deletions
diff --git a/test/bitfield-assignment-sign-extend.qbe b/test/bitfield-assignment-sign-extend.qbe
index 0a4d221..ceaa1f9 100644
--- a/test/bitfield-assignment-sign-extend.qbe
+++ b/test/bitfield-assignment-sign-extend.qbe
@@ -12,7 +12,7 @@ function w $main() {
%.8 =w and %.7, 18446744073709551600
%.9 =w or %.6, %.8
storew %.9, %.2
- %.10 =w sub 0, 1
+ %.10 =w neg 1
%.11 =w cnew %.5, %.10
ret %.11
}
diff --git a/test/bitfield-integer-promotion.qbe b/test/bitfield-integer-promotion.qbe
index 993ca8d..ab9d4a7 100644
--- a/test/bitfield-integer-promotion.qbe
+++ b/test/bitfield-integer-promotion.qbe
@@ -2,7 +2,7 @@ export
function w $main() {
@start.1
@body.2
- %.1 =w sub 0, 1
+ %.1 =w neg 1
%.2 =l mul 0, 1
%.3 =l add $s, %.2
%.4 =w loadw %.3
diff --git a/test/char-sign+aarch64.qbe b/test/char-sign+aarch64.qbe
index 002f645..aa8d8bc 100644
--- a/test/char-sign+aarch64.qbe
+++ b/test/char-sign+aarch64.qbe
@@ -3,7 +3,7 @@ export
function w $main() {
@start.1
@body.2
- %.1 =w sub 0, 1
+ %.1 =w neg 1
%.2 =w extub %.1
%.3 =w csltw %.2, 0
ret %.3
diff --git a/test/char-sign+riscv64.qbe b/test/char-sign+riscv64.qbe
index 002f645..aa8d8bc 100644
--- a/test/char-sign+riscv64.qbe
+++ b/test/char-sign+riscv64.qbe
@@ -3,7 +3,7 @@ export
function w $main() {
@start.1
@body.2
- %.1 =w sub 0, 1
+ %.1 =w neg 1
%.2 =w extub %.1
%.3 =w csltw %.2, 0
ret %.3
diff --git a/test/char-sign+x86_64.qbe b/test/char-sign+x86_64.qbe
index 0e44442..ddf6f3f 100644
--- a/test/char-sign+x86_64.qbe
+++ b/test/char-sign+x86_64.qbe
@@ -3,7 +3,7 @@ export
function w $main() {
@start.1
@body.2
- %.1 =w sub 0, 1
+ %.1 =w neg 1
%.2 =w extsb %.1
%.3 =w csgtw %.2, 0
ret %.3
diff --git a/test/common-real-int-sign.qbe b/test/common-real-int-sign.qbe
index 6de74a3..198ca6a 100644
--- a/test/common-real-int-sign.qbe
+++ b/test/common-real-int-sign.qbe
@@ -2,7 +2,7 @@ export
function w $main() {
@start.1
@body.2
- %.1 =w sub 0, 1
+ %.1 =w neg 1
%.2 =w cugtw 0, %.1
ret %.2
}
diff --git a/test/expr-neg.c b/test/expr-neg.c
new file mode 100644
index 0000000..a13be46
--- /dev/null
+++ b/test/expr-neg.c
@@ -0,0 +1,3 @@
+double f(double x) {
+ return -x;
+}
diff --git a/test/expr-neg.qbe b/test/expr-neg.qbe
new file mode 100644
index 0000000..ab95a4a
--- /dev/null
+++ b/test/expr-neg.qbe
@@ -0,0 +1,10 @@
+export
+function d $f(d %.1) {
+@start.1
+ %.2 =l alloc8 8
+ stored %.1, %.2
+@body.2
+ %.3 =d loadd %.2
+ %.4 =d neg %.3
+ ret %.4
+}
diff --git a/test/wchar-sign+aarch64.qbe b/test/wchar-sign+aarch64.qbe
index c81124d..38271a9 100644
--- a/test/wchar-sign+aarch64.qbe
+++ b/test/wchar-sign+aarch64.qbe
@@ -3,7 +3,7 @@ export
function w $main() {
@start.1
@body.2
- %.1 =w sub 0, 1
+ %.1 =w neg 1
%.2 =w cultw %.1, 0
ret %.2
}
diff --git a/test/wchar-sign+riscv64.qbe b/test/wchar-sign+riscv64.qbe
index 8f84971..888a5c9 100644
--- a/test/wchar-sign+riscv64.qbe
+++ b/test/wchar-sign+riscv64.qbe
@@ -3,7 +3,7 @@ export
function w $main() {
@start.1
@body.2
- %.1 =w sub 0, 1
+ %.1 =w neg 1
%.2 =w csgtw %.1, 0
ret %.2
}
diff --git a/test/wchar-sign+x86_64.qbe b/test/wchar-sign+x86_64.qbe
index 8f84971..888a5c9 100644
--- a/test/wchar-sign+x86_64.qbe
+++ b/test/wchar-sign+x86_64.qbe
@@ -3,7 +3,7 @@ export
function w $main() {
@start.1
@body.2
- %.1 =w sub 0, 1
+ %.1 =w neg 1
%.2 =w csgtw %.1, 0
ret %.2
}