summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/RISCV/module-target-abi.ll
diff options
context:
space:
mode:
authorZakk Chen <zakk.chen@sifive.com>2020-01-15 06:41:08 -0800
committerHans Wennborg <hans@chromium.org>2020-01-27 19:06:22 +0100
commit7c5784746cfc6dc1906359704da5a4c95b64fb47 (patch)
tree011f1d68ad5fc573b25dce5335b39f422d3e9967 /llvm/test/CodeGen/RISCV/module-target-abi.ll
parent01fd650ba3d29709e82a608dfa7fcec35606385d (diff)
downloadbcm5719-llvm-7c5784746cfc6dc1906359704da5a4c95b64fb47.tar.gz
bcm5719-llvm-7c5784746cfc6dc1906359704da5a4c95b64fb47.zip
[RISCV] Check the target-abi module flag matches the option
Reviewers: lenary, asb Reviewed By: lenary Tags: #llvm Differential Revision: https://reviews.llvm.org/D72768 (cherry picked from commit 1256d68093ac1696034e385bbb4cb6e516b66bea)
Diffstat (limited to 'llvm/test/CodeGen/RISCV/module-target-abi.ll')
-rw-r--r--llvm/test/CodeGen/RISCV/module-target-abi.ll24
1 files changed, 24 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/RISCV/module-target-abi.ll b/llvm/test/CodeGen/RISCV/module-target-abi.ll
new file mode 100644
index 00000000000..b2930a06ab7
--- /dev/null
+++ b/llvm/test/CodeGen/RISCV/module-target-abi.ll
@@ -0,0 +1,24 @@
+; RUN: llc -mtriple=riscv32 < %s 2>&1 \
+; RUN: | FileCheck -check-prefix=DEFAULT %s
+; RUN: llc -mtriple=riscv32 -target-abi ilp32 < %s 2>&1 \
+; RUN: | FileCheck -check-prefix=RV32IF-ILP32 %s
+; RUN: not llc -mtriple=riscv32 -target-abi ilp32f < %s 2>&1 \
+; RUN: | FileCheck -check-prefix=RV32IF-ILP32F %s
+; RUN: llc -mtriple=riscv32 -filetype=obj < %s | llvm-readelf -h - | FileCheck -check-prefixes=FLAGS %s
+
+; RV32IF-ILP32F: -target-abi option != target-abi module flag
+
+; FLAGS: Flags: 0x0
+
+define float @foo(i32 %a) nounwind #0 {
+; DEFAULT: # %bb.0:
+; DEFAULT: fmv.x.w a0, ft0
+; RV32IF-ILP32: # %bb.0:
+; RV32IF-ILP32: fmv.x.w a0, ft0
+ %conv = sitofp i32 %a to float
+ ret float %conv
+}
+
+attributes #0 = { "target-features"="+f"}
+!llvm.module.flags = !{!0}
+!0 = !{i32 1, !"target-abi", !"ilp32"}
OpenPOWER on IntegriCloud