summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Bradbury <asb@lowrisc.org>2018-04-18 16:43:03 +0000
committerAlex Bradbury <asb@lowrisc.org>2018-04-18 16:43:03 +0000
commit75a4e52580c047b8f5527f79a93cb3daea772968 (patch)
treeabac40793194c7beb88aa2ceee94b609f64e6609
parent198e67857645aa25164aead779d18d65bb75a510 (diff)
downloadbcm5719-llvm-75a4e52580c047b8f5527f79a93cb3daea772968.tar.gz
bcm5719-llvm-75a4e52580c047b8f5527f79a93cb3daea772968.zip
[RISCV] Add specific tests for materialising imm32hi20 constants
i.e. constants that can be materialised with a single lui, as the lower 12 bits are zero. llvm-svn: 330274
-rw-r--r--llvm/test/CodeGen/RISCV/imm.ll16
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/RISCV/imm.ll b/llvm/test/CodeGen/RISCV/imm.ll
index dca1c5e1e1e..b9e2f8a40c6 100644
--- a/llvm/test/CodeGen/RISCV/imm.ll
+++ b/llvm/test/CodeGen/RISCV/imm.ll
@@ -45,3 +45,19 @@ define i32 @neg_i32() nounwind {
; RV32I-NEXT: ret
ret i32 -559038737
}
+
+define i32 @pos_i32_hi20_only() nounwind {
+; RV32I-LABEL: pos_i32_hi20_only:
+; RV32I: # %bb.0:
+; RV32I-NEXT: lui a0, 16
+; RV32I-NEXT: ret
+ ret i32 65536
+}
+
+define i32 @neg_i32_hi20_only() nounwind {
+; RV32I-LABEL: neg_i32_hi20_only:
+; RV32I: # %bb.0:
+; RV32I-NEXT: lui a0, 1048560
+; RV32I-NEXT: ret
+ ret i32 -65536
+}
OpenPOWER on IntegriCloud