[PATCH] D87210: [Sparc] Remove cast that truncates immediate operands to 32 bits.

Brad Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 2 17:15:38 PDT 2020


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9ae95a0f8f1b: [Sparc] Remove cast that truncates immediate operands to 32 bits. (authored by brad).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87210/new/

https://reviews.llvm.org/D87210

Files:
  llvm/lib/Target/Sparc/SparcAsmPrinter.cpp
  llvm/test/CodeGen/SPARC/inlineasm-v9.ll


Index: llvm/test/CodeGen/SPARC/inlineasm-v9.ll
===================================================================
--- llvm/test/CodeGen/SPARC/inlineasm-v9.ll
+++ llvm/test/CodeGen/SPARC/inlineasm-v9.ll
@@ -39,3 +39,12 @@
   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
+}
Index: llvm/lib/Target/Sparc/SparcAsmPrinter.cpp
===================================================================
--- llvm/lib/Target/Sparc/SparcAsmPrinter.cpp
+++ llvm/lib/Target/Sparc/SparcAsmPrinter.cpp
@@ -351,7 +351,7 @@
     break;
 
   case MachineOperand::MO_Immediate:
-    O << (int)MO.getImm();
+    O << MO.getImm();
     break;
   case MachineOperand::MO_MachineBasicBlock:
     MO.getMBB()->getSymbol()->print(O, MAI);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87210.295939.patch
Type: text/x-patch
Size: 1056 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201003/83e7a06d/attachment.bin>


More information about the llvm-commits mailing list