diff options
| author | Daniel Cederman <cederman@gaisler.com> | 2018-12-13 15:13:29 +0000 |
|---|---|---|
| committer | Daniel Cederman <cederman@gaisler.com> | 2018-12-13 15:13:29 +0000 |
| commit | b5d284408e20e8a9fddf4666854533049a4a62aa (patch) | |
| tree | 4633e8aad96b7351e18bf40d1e5adaedf3d33144 /llvm/test/CodeGen/SPARC | |
| parent | c7b43b94ced62e9ce4c7cbb6a1cbafa350e646fa (diff) | |
| download | bcm5719-llvm-b5d284408e20e8a9fddf4666854533049a4a62aa.tar.gz bcm5719-llvm-b5d284408e20e8a9fddf4666854533049a4a62aa.zip | |
[Sparc] Use float register for integer constrained with "f" in inline asm
Summary:
Constraining an integer value to a floating point register using "f"
causes an llvm_unreachable to trigger. This patch allows i32 integers
to be placed in a single precision float register and i64 integers to
be placed in a double precision float register. This matches the behavior
of GCC.
For other types the llvm_unreachable is removed to instead trigger an
error message that points out the offending line.
Reviewers: jyknight, venkatra
Reviewed By: jyknight
Subscribers: eraman, fedor.sergeev, jrtc27, llvm-commits
Differential Revision: https://reviews.llvm.org/D51614
llvm-svn: 349045
Diffstat (limited to 'llvm/test/CodeGen/SPARC')
| -rw-r--r-- | llvm/test/CodeGen/SPARC/inlineasm.ll | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/SPARC/inlineasm.ll b/llvm/test/CodeGen/SPARC/inlineasm.ll index a67a45e6b1d..814845459de 100644 --- a/llvm/test/CodeGen/SPARC/inlineasm.ll +++ b/llvm/test/CodeGen/SPARC/inlineasm.ll @@ -130,3 +130,16 @@ entry: tail call void asm sideeffect "faddd $0,$1,$2", "{f20},{f20},{f20}"(double 9.0, double 10.0, double 11.0) ret void } + +; CHECK-LABEL: test_constraint_f_e_i32_i64: +; CHECK: ld [%o0+%lo(.LCPI13_0)], %f0 +; CHECK: ldd [%o0+%lo(.LCPI13_1)], %f2 +; CHECK: fadds %f0, %f0, %f0 +; CHECK: faddd %f2, %f2, %f0 + +define void @test_constraint_f_e_i32_i64() { +entry: + %0 = call float asm sideeffect "fadds $1, $2, $0", "=f,f,e"(i32 0, i32 0) + %1 = call double asm sideeffect "faddd $1, $2, $0", "=f,f,e"(i64 0, i64 0) + ret void +} |

