aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2022-05-09 12:57:57 -0700
committerMichael Forney <mforney@mforney.org>2022-05-09 13:05:22 -0700
commitfb00ba697821de4fb3d8d0dd44edfa5f4727d067 (patch)
tree33ac4c8a3b8fc64cd7386b03c9d01857f98fd638 /test
parent70fe9ef1810cc6c05bde9eb0970363c35fa7e802 (diff)
expr: Use integer type for member access intermediate address calculation
Diffstat (limited to 'test')
-rw-r--r--test/bitfield-assignment-sign-extend.qbe25
-rw-r--r--test/bitfield-compound-assign.qbe27
-rw-r--r--test/bitfield-integer-promotion.qbe13
-rw-r--r--test/bitfield-load-signed.qbe9
-rw-r--r--test/bitfield-load-unsigned.qbe9
-rw-r--r--test/bitfield-short.qbe15
-rw-r--r--test/struct-flexible-array.qbe15
-rw-r--r--test/struct-return-2.qbe7
8 files changed, 56 insertions, 64 deletions
diff --git a/test/bitfield-assignment-sign-extend.qbe b/test/bitfield-assignment-sign-extend.qbe
index ceaa1f9..3589d2f 100644
--- a/test/bitfield-assignment-sign-extend.qbe
+++ b/test/bitfield-assignment-sign-extend.qbe
@@ -2,18 +2,17 @@ export
function w $main() {
@start.1
@body.2
- %.1 =l mul 0, 1
- %.2 =l add $s, %.1
- %.3 =w shl 15, 0
- %.4 =w shl %.3, 28
- %.5 =w sar %.4, 28
- %.6 =w and %.3, 15
- %.7 =w loadw %.2
- %.8 =w and %.7, 18446744073709551600
- %.9 =w or %.6, %.8
- storew %.9, %.2
- %.10 =w neg 1
- %.11 =w cnew %.5, %.10
- ret %.11
+ %.1 =l add $s, 0
+ %.2 =w shl 15, 0
+ %.3 =w shl %.2, 28
+ %.4 =w sar %.3, 28
+ %.5 =w and %.2, 15
+ %.6 =w loadw %.1
+ %.7 =w and %.6, 18446744073709551600
+ %.8 =w or %.5, %.7
+ storew %.8, %.1
+ %.9 =w neg 1
+ %.10 =w cnew %.4, %.9
+ ret %.10
}
export data $s = align 4 { z 4 }
diff --git a/test/bitfield-compound-assign.qbe b/test/bitfield-compound-assign.qbe
index 4d49a6b..dc57e79 100644
--- a/test/bitfield-compound-assign.qbe
+++ b/test/bitfield-compound-assign.qbe
@@ -2,20 +2,19 @@ export
function $f() {
@start.1
@body.2
- %.1 =l mul 0, 1
- %.2 =l add $s, %.1
- %.3 =w loadw %.2
- %.4 =w shl %.3, 19
- %.5 =w sar %.4, 23
- %.6 =w add %.5, 3
- %.7 =w shl %.6, 4
- %.8 =w shl %.7, 19
- %.9 =w sar %.8, 23
- %.10 =w and %.7, 8176
- %.11 =w loadw %.2
- %.12 =w and %.11, 18446744073709543439
- %.13 =w or %.10, %.12
- storew %.13, %.2
+ %.1 =l add $s, 0
+ %.2 =w loadw %.1
+ %.3 =w shl %.2, 19
+ %.4 =w sar %.3, 23
+ %.5 =w add %.4, 3
+ %.6 =w shl %.5, 4
+ %.7 =w shl %.6, 19
+ %.8 =w sar %.7, 23
+ %.9 =w and %.6, 8176
+ %.10 =w loadw %.1
+ %.11 =w and %.10, 18446744073709543439
+ %.12 =w or %.9, %.11
+ storew %.12, %.1
ret
}
export data $s = align 4 { z 4 }
diff --git a/test/bitfield-integer-promotion.qbe b/test/bitfield-integer-promotion.qbe
index ab9d4a7..b97d7ac 100644
--- a/test/bitfield-integer-promotion.qbe
+++ b/test/bitfield-integer-promotion.qbe
@@ -3,12 +3,11 @@ function w $main() {
@start.1
@body.2
%.1 =w neg 1
- %.2 =l mul 0, 1
- %.3 =l add $s, %.2
- %.4 =w loadw %.3
- %.5 =w shl %.4, 30
- %.6 =w shr %.5, 30
- %.7 =w csgtw %.1, %.6
- ret %.7
+ %.2 =l add $s, 0
+ %.3 =w loadw %.2
+ %.4 =w shl %.3, 30
+ %.5 =w shr %.4, 30
+ %.6 =w csgtw %.1, %.5
+ ret %.6
}
export data $s = align 4 { z 4 }
diff --git a/test/bitfield-load-signed.qbe b/test/bitfield-load-signed.qbe
index 12b474f..386395c 100644
--- a/test/bitfield-load-signed.qbe
+++ b/test/bitfield-load-signed.qbe
@@ -2,11 +2,10 @@ export
function $f() {
@start.1
@body.2
- %.1 =l mul 0, 1
- %.2 =l add $s, %.1
- %.3 =w loadw %.2
- %.4 =w shl %.3, 13
- %.5 =w sar %.4, 17
+ %.1 =l add $s, 0
+ %.2 =w loadw %.1
+ %.3 =w shl %.2, 13
+ %.4 =w sar %.3, 17
ret
}
export data $s = align 4 { z 4 }
diff --git a/test/bitfield-load-unsigned.qbe b/test/bitfield-load-unsigned.qbe
index decb72f..cc764c9 100644
--- a/test/bitfield-load-unsigned.qbe
+++ b/test/bitfield-load-unsigned.qbe
@@ -2,11 +2,10 @@ export
function $f() {
@start.1
@body.2
- %.1 =l mul 0, 1
- %.2 =l add $s, %.1
- %.3 =w loadw %.2
- %.4 =w shl %.3, 13
- %.5 =w shr %.4, 17
+ %.1 =l add $s, 0
+ %.2 =w loadw %.1
+ %.3 =w shl %.2, 13
+ %.4 =w shr %.3, 17
ret
}
export data $s = align 4 { z 4 }
diff --git a/test/bitfield-short.qbe b/test/bitfield-short.qbe
index e8bc086..d6a706b 100644
--- a/test/bitfield-short.qbe
+++ b/test/bitfield-short.qbe
@@ -3,12 +3,11 @@ export
function w $main() {
@start.1
@body.2
- %.1 =l mul 0, 1
- %.2 =l add $s, %.1
- %.3 =w loadsh %.2
- %.4 =w shl %.3, 25
- %.5 =w sar %.4, 25
- %.6 =w extsh %.5
- %.7 =w csgtw %.6, 0
- ret %.7
+ %.1 =l add $s, 0
+ %.2 =w loadsh %.1
+ %.3 =w shl %.2, 25
+ %.4 =w sar %.3, 25
+ %.5 =w extsh %.4
+ %.6 =w csgtw %.5, 0
+ ret %.6
}
diff --git a/test/struct-flexible-array.qbe b/test/struct-flexible-array.qbe
index 464bfa4..915b281 100644
--- a/test/struct-flexible-array.qbe
+++ b/test/struct-flexible-array.qbe
@@ -6,12 +6,11 @@ function w $f(l %.1) {
storel %.1, %.2
@body.2
%.3 =l loadl %.2
- %.4 =l mul 4, 1
- %.5 =l add %.3, %.4
- %.6 =l extsw 2
- %.7 =l mul %.6, 2
- %.8 =l add %.5, %.7
- %.9 =w loadsh %.8
- %.10 =w extsh %.9
- ret %.10
+ %.4 =l add %.3, 4
+ %.5 =l extsw 2
+ %.6 =l mul %.5, 2
+ %.7 =l add %.4, %.6
+ %.8 =w loadsh %.7
+ %.9 =w extsh %.8
+ ret %.9
}
diff --git a/test/struct-return-2.qbe b/test/struct-return-2.qbe
index 49cb817..189094b 100644
--- a/test/struct-return-2.qbe
+++ b/test/struct-return-2.qbe
@@ -4,8 +4,7 @@ function w $f() {
@start.1
@body.2
%.1 =:.1 call $g()
- %.2 =l mul 4, 1
- %.3 =l add %.1, %.2
- %.4 =w loadw %.3
- ret %.4
+ %.2 =l add %.1, 4
+ %.3 =w loadw %.2
+ ret %.3
}