This is an archive of the discontinued LLVM Phabricator instance.

[Sparc] Remove cast that truncates immediate operands to 32 bits.
ClosedPublic

Authored by brad on Sep 6 2020, 2:18 PM.

Details

Summary

Remove cast that truncates immediate operands to 32 bits.

Diff Detail

Event Timeline

brad created this revision.Sep 6 2020, 2:18 PM
brad requested review of this revision.Sep 6 2020, 2:18 PM
jrtc27 requested changes to this revision.Sep 6 2020, 2:33 PM

Needs a test case; something like:

diff --git a/llvm/test/CodeGen/SPARC/inlineasm-v9.ll b/llvm/test/CodeGen/SPARC/inlineasm-v9.ll
index 53ab114dd8d5..1388c8655ace 100644
--- a/llvm/test/CodeGen/SPARC/inlineasm-v9.ll
+++ b/llvm/test/CodeGen/SPARC/inlineasm-v9.ll
@@ -39,3 +39,12 @@ entry:
   tail call void asm sideeffect "faddq $0,$1,$2", "{f40},{f40},{f40}"(fp128 0xL0, fp128 0xL0, fp128 0xL0)
   ret void
 }
+
+;; Ensure that 64-bit immediates aren't truncated
+; CHECK-LABEL: test_large_immediate
+; CHECK: or %o0, %lo(4294967296), %o0
+define i64 @test_large_immediate(i64) {
+entry:
+  %1 = tail call i64 asm "or $0, %lo($1), $0", "=r,i,r"(i64 4294967296, i64 %0)
+  ret i64 %1
+}

as I believe this only affects emitting inline assembly operands (normal and memory)? Round-tripping assembly through llvm-mc isn't enough to hit this path.

This revision now requires changes to proceed.Sep 6 2020, 2:33 PM
brad updated this revision to Diff 290162.Sep 6 2020, 7:19 PM

Added provided test.

brad added a comment.Sep 8 2020, 7:10 PM

Is this Ok or is any further testing necessary?

brad added a comment.Sep 11 2020, 3:13 PM

Venkatraman?

This revision was not accepted when it landed; it landed in state Needs Review.Oct 2 2020, 5:15 PM
This revision was automatically updated to reflect the committed changes.