summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Smith <brad@comstyle.com>2020-10-02 20:05:09 -0400
committerTom Stellard <tstellar@redhat.com>2020-12-09 20:23:57 -0500
commit852f4d8eb6d317be0947055c0bb6b4fd6c9aa930 (patch)
treeb23c291256891ce4a4fa04f72c65399c268f0455
parentb091768e60e6807ae3806acaba1cbc9b1c96b388 (diff)
downloadllvm-852f4d8eb6d317be0947055c0bb6b4fd6c9aa930.tar.gz
[Sparc] Remove cast that truncates immediate operands to 32 bits.
Patch by: Mark Kettenis Test provided by Jessica Clarke. Differential Revision: https://reviews.llvm.org/D87210 (cherry picked from commit 9ae95a0f8f1bc9bd9e8eb30a5a9444fbdca5cc29)
-rw-r--r--llvm/lib/Target/Sparc/SparcAsmPrinter.cpp2
-rw-r--r--llvm/test/CodeGen/SPARC/inlineasm-v9.ll9
2 files changed, 10 insertions, 1 deletions
diff --git a/llvm/lib/Target/Sparc/SparcAsmPrinter.cpp b/llvm/lib/Target/Sparc/SparcAsmPrinter.cpp
index 069e43c6f544..7845a18b14c1 100644
--- a/llvm/lib/Target/Sparc/SparcAsmPrinter.cpp
+++ b/llvm/lib/Target/Sparc/SparcAsmPrinter.cpp
@@ -351,7 +351,7 @@ void SparcAsmPrinter::printOperand(const MachineInstr *MI, int opNum,
break;
case MachineOperand::MO_Immediate:
- O << (int)MO.getImm();
+ O << MO.getImm();
break;
case MachineOperand::MO_MachineBasicBlock:
MO.getMBB()->getSymbol()->print(O, MAI);
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
+}