summaryrefslogtreecommitdiff
path: root/test/CodeGen/SPARC
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2013-04-02 04:09:17 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2013-04-02 04:09:17 +0000
commit39e75544dc2b695997218ce85f7ca5b465e9c154 (patch)
tree72a655522b236a304eb4e93c742123b683b4de73 /test/CodeGen/SPARC
parentc3ff3f42ee9a9fb755b0eb0718a31d701b93b3e0 (diff)
downloadllvm-39e75544dc2b695997218ce85f7ca5b465e9c154.tar.gz
llvm-39e75544dc2b695997218ce85f7ca5b465e9c154.tar.bz2
llvm-39e75544dc2b695997218ce85f7ca5b465e9c154.tar.xz
Materialize 64-bit immediates.
The last resort pattern produces 6 instructions, and there are still opportunities for materializing some immediates in fewer instructions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178526 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/SPARC')
-rw-r--r--test/CodeGen/SPARC/64bit.ll46
1 files changed, 46 insertions, 0 deletions
diff --git a/test/CodeGen/SPARC/64bit.ll b/test/CodeGen/SPARC/64bit.ll
index 6387e00427..b0c9852ef2 100644
--- a/test/CodeGen/SPARC/64bit.ll
+++ b/test/CodeGen/SPARC/64bit.ll
@@ -19,3 +19,49 @@ define i64 @sra_reg(i64 %a, i64 %b) {
%x = ashr i64 %a, %b
ret i64 %x
}
+
+; Immediate materialization. Many of these patterns could actually be merged
+; into the restore instruction:
+;
+; restore %g0, %g0, %o0
+;
+; CHECK: ret_imm0
+; CHECK: or %g0, %g0, %i0
+define i64 @ret_imm0() {
+ ret i64 0
+}
+
+; CHECK: ret_simm13
+; CHECK: or %g0, -4096, %i0
+define i64 @ret_simm13() {
+ ret i64 -4096
+}
+
+; CHECK: ret_sethi
+; CHECK: sethi 4, %i0
+; CHECK-NOT: or
+; CHECK: restore
+define i64 @ret_sethi() {
+ ret i64 4096
+}
+
+; CHECK: ret_sethi
+; CHECK: sethi 4, [[R:%[goli][0-7]]]
+; CHECK: or [[R]], 1, %i0
+define i64 @ret_sethi_or() {
+ ret i64 4097
+}
+
+; CHECK: ret_nimm33
+; CHECK: sethi 4, [[R:%[goli][0-7]]]
+; CHECK: xor [[R]], -4, %i0
+define i64 @ret_nimm33() {
+ ret i64 -4100
+}
+
+; CHECK: ret_bigimm
+; CHECK: sethi
+; CHECK: sethi
+define i64 @ret_bigimm() {
+ ret i64 6800754272627607872
+}