diff options
author | Michael Forney <mforney@mforney.org> | 2021-07-05 22:26:52 -0700 |
---|---|---|
committer | Michael Forney <mforney@mforney.org> | 2021-07-05 22:26:57 -0700 |
commit | 7bf0c0fb11af04d50cf7c374a44aa6101cca9c9d (patch) | |
tree | 4a54ad7462e00b49e2e7b981daedcd94f408ed5a /test/bitfield-short.qbe | |
parent | 003f6a14b05bb16fa6f950dc193a8cbd62e0836d (diff) |
qbe: Fix bitfield sign extension with types shorter than int
Diffstat (limited to 'test/bitfield-short.qbe')
-rw-r--r-- | test/bitfield-short.qbe | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/bitfield-short.qbe b/test/bitfield-short.qbe new file mode 100644 index 0000000..e8bc086 --- /dev/null +++ b/test/bitfield-short.qbe @@ -0,0 +1,14 @@ +export data $s = align 2 { b 64, z 1 } +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 +} |