[llvm] r207669 - ARM64: print fp immediates without using scientific notation.
Tim Northover
tnorthover at apple.com
Wed Apr 30 09:13:34 PDT 2014
Author: tnorthover
Date: Wed Apr 30 11:13:34 2014
New Revision: 207669
URL: http://llvm.org/viewvc/llvm-project?rev=207669&view=rev
Log:
ARM64: print fp immediates without using scientific notation.
Modified:
llvm/trunk/lib/Target/ARM64/InstPrinter/ARM64InstPrinter.cpp
llvm/trunk/test/CodeGen/ARM64/fast-isel-materialize.ll
llvm/trunk/test/CodeGen/ARM64/vector-imm.ll
llvm/trunk/test/CodeGen/ARM64/vector-insertion.ll
llvm/trunk/test/MC/ARM64/advsimd.s
llvm/trunk/test/MC/ARM64/fp-encoding.s
llvm/trunk/test/MC/ARM64/optional-hash.s
llvm/trunk/test/MC/Disassembler/ARM64/advsimd.txt
llvm/trunk/test/MC/Disassembler/ARM64/scalar-fp.txt
Modified: llvm/trunk/lib/Target/ARM64/InstPrinter/ARM64InstPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM64/InstPrinter/ARM64InstPrinter.cpp?rev=207669&r1=207668&r2=207669&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM64/InstPrinter/ARM64InstPrinter.cpp (original)
+++ llvm/trunk/lib/Target/ARM64/InstPrinter/ARM64InstPrinter.cpp Wed Apr 30 11:13:34 2014
@@ -1221,12 +1221,10 @@ void ARM64InstPrinter::printMemoryRegOff
void ARM64InstPrinter::printFPImmOperand(const MCInst *MI, unsigned OpNum,
raw_ostream &O) {
const MCOperand &MO = MI->getOperand(OpNum);
- O << '#';
- if (MO.isFPImm())
- // FIXME: Should this ever happen?
- O << MO.getFPImm();
- else
- O << ARM64_AM::getFPImmFloat(MO.getImm());
+ float FPImm = MO.isFPImm() ? MO.getFPImm() : ARM64_AM::getFPImmFloat(MO.getImm());
+
+ // 8 decimal places are enough to perfectly represent permitted floats.
+ O << format("#%.8f", FPImm);
}
static unsigned getNextVectorRegister(unsigned Reg, unsigned Stride = 1) {
Modified: llvm/trunk/test/CodeGen/ARM64/fast-isel-materialize.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM64/fast-isel-materialize.ll?rev=207669&r1=207668&r2=207669&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM64/fast-isel-materialize.ll (original)
+++ llvm/trunk/test/CodeGen/ARM64/fast-isel-materialize.ll Wed Apr 30 11:13:34 2014
@@ -3,14 +3,14 @@
; Materialize using fmov
define void @float_(float* %value) {
; CHECK: @float_
-; CHECK: fmov s0, #1.250000e+00
+; CHECK: fmov s0, #1.25000000
store float 1.250000e+00, float* %value, align 4
ret void
}
define void @double_(double* %value) {
; CHECK: @double_
-; CHECK: fmov d0, #1.250000e+00
+; CHECK: fmov d0, #1.25000000
store double 1.250000e+00, double* %value, align 8
ret void
}
Modified: llvm/trunk/test/CodeGen/ARM64/vector-imm.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM64/vector-imm.ll?rev=207669&r1=207668&r2=207669&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM64/vector-imm.ll (original)
+++ llvm/trunk/test/CodeGen/ARM64/vector-imm.ll Wed Apr 30 11:13:34 2014
@@ -42,7 +42,7 @@ define <16 x i8> @v_bicimmQ(<16 x i8>* %
define <2 x double> @foo(<2 x double> %bar) nounwind {
; CHECK: foo
-; CHECK: fmov.2d v1, #1.000000e+00
+; CHECK: fmov.2d v1, #1.0000000
%add = fadd <2 x double> %bar, <double 1.0, double 1.0>
ret <2 x double> %add
}
@@ -122,13 +122,13 @@ ret <2 x i64> <i64 71777214294589695, i6
define <4 x i32> @movi_4s_imm_t11() nounwind readnone ssp {
entry:
; CHECK-LABEL: movi_4s_imm_t11:
-; CHECK: fmov.4s v0, #-3.281250e-01
+; CHECK: fmov.4s v0, #-0.32812500
ret <4 x i32> <i32 3198681088, i32 3198681088, i32 3198681088, i32 3198681088>
}
define <2 x i64> @movi_2d_imm_t12() nounwind readnone ssp {
entry:
; CHECK-LABEL: movi_2d_imm_t12:
-; CHECK: fmov.2d v0, #-1.718750e-01
+; CHECK: fmov.2d v0, #-0.17187500
ret <2 x i64> <i64 13818732506632945664, i64 13818732506632945664>
}
Modified: llvm/trunk/test/CodeGen/ARM64/vector-insertion.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM64/vector-insertion.ll?rev=207669&r1=207668&r2=207669&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM64/vector-insertion.ll (original)
+++ llvm/trunk/test/CodeGen/ARM64/vector-insertion.ll Wed Apr 30 11:13:34 2014
@@ -25,7 +25,7 @@ entry:
ret void
; CHECK-LABEL: test1f
- ; CHECK: fmov s[[TEMP:[0-9]+]], #1.000000e+00
+ ; CHECK: fmov s[[TEMP:[0-9]+]], #1.0000000
; CHECK: dup.4s v[[TEMP2:[0-9]+]], v[[TEMP]][0]
; CHECK: ins.s v[[TEMP2]][0], v0[0]
; CHECK: str q[[TEMP2]], [x0]
Modified: llvm/trunk/test/MC/ARM64/advsimd.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM64/advsimd.s?rev=207669&r1=207668&r2=207669&view=diff
==============================================================================
--- llvm/trunk/test/MC/ARM64/advsimd.s (original)
+++ llvm/trunk/test/MC/ARM64/advsimd.s Wed Apr 30 11:13:34 2014
@@ -816,13 +816,13 @@ foo:
fmov.2d v0, #1.250000e-01
-; CHECK: fmov.2d v0, #1.250000e-01 ; encoding: [0x00,0xf4,0x02,0x6f]
+; CHECK: fmov.2d v0, #0.12500000 ; encoding: [0x00,0xf4,0x02,0x6f]
fmov.2s v0, #1.250000e-01
fmov.4s v0, #1.250000e-01
-; CHECK: fmov.2s v0, #1.250000e-01 ; encoding: [0x00,0xf4,0x02,0x0f]
-; CHECK: fmov.4s v0, #1.250000e-01 ; encoding: [0x00,0xf4,0x02,0x4f]
+; CHECK: fmov.2s v0, #0.12500000 ; encoding: [0x00,0xf4,0x02,0x0f]
+; CHECK: fmov.4s v0, #0.12500000 ; encoding: [0x00,0xf4,0x02,0x4f]
orr.2s v0, #1
orr.2s v0, #1, lsl #0
Modified: llvm/trunk/test/MC/ARM64/fp-encoding.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM64/fp-encoding.s?rev=207669&r1=207668&r2=207669&view=diff
==============================================================================
--- llvm/trunk/test/MC/ARM64/fp-encoding.s (original)
+++ llvm/trunk/test/MC/ARM64/fp-encoding.s Wed Apr 30 11:13:34 2014
@@ -333,13 +333,13 @@ foo:
fmov s2, #0.0
fmov d2, #0.0
-; CHECK: fmov s1, #1.250000e-01 ; encoding: [0x01,0x10,0x28,0x1e]
-; CHECK: fmov s1, #1.250000e-01 ; encoding: [0x01,0x10,0x28,0x1e]
-; CHECK: fmov d1, #1.250000e-01 ; encoding: [0x01,0x10,0x68,0x1e]
-; CHECK: fmov d1, #1.250000e-01 ; encoding: [0x01,0x10,0x68,0x1e]
-; CHECK: fmov d1, #-4.843750e-01 ; encoding: [0x01,0xf0,0x7b,0x1e]
-; CHECK: fmov d1, #4.843750e-01 ; encoding: [0x01,0xf0,0x6b,0x1e]
-; CHECK: fmov d3, #3.000000e+00 ; encoding: [0x03,0x10,0x61,0x1e]
+; CHECK: fmov s1, #0.12500000 ; encoding: [0x01,0x10,0x28,0x1e]
+; CHECK: fmov s1, #0.12500000 ; encoding: [0x01,0x10,0x28,0x1e]
+; CHECK: fmov d1, #0.12500000 ; encoding: [0x01,0x10,0x68,0x1e]
+; CHECK: fmov d1, #0.12500000 ; encoding: [0x01,0x10,0x68,0x1e]
+; CHECK: fmov d1, #-0.48437500 ; encoding: [0x01,0xf0,0x7b,0x1e]
+; CHECK: fmov d1, #0.48437500 ; encoding: [0x01,0xf0,0x6b,0x1e]
+; CHECK: fmov d3, #3.00000000 ; encoding: [0x03,0x10,0x61,0x1e]
; CHECK: fmov s2, wzr ; encoding: [0xe2,0x03,0x27,0x1e]
; CHECK: fmov d2, xzr ; encoding: [0xe2,0x03,0x67,0x9e]
Modified: llvm/trunk/test/MC/ARM64/optional-hash.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM64/optional-hash.s?rev=207669&r1=207668&r2=207669&view=diff
==============================================================================
--- llvm/trunk/test/MC/ARM64/optional-hash.s (original)
+++ llvm/trunk/test/MC/ARM64/optional-hash.s Wed Apr 30 11:13:34 2014
@@ -13,7 +13,7 @@ adds x3, x4, 1024, lsl 12
add sp, x2, x3, uxtx 0
; FP immediates
-; CHECK: fmov s1, #1.250000e-01 ; encoding: [0x01,0x10,0x28,0x1e]
+; CHECK: fmov s1, #0.12500000 ; encoding: [0x01,0x10,0x28,0x1e]
fmov s1, 0.125
; Barrier operand
Modified: llvm/trunk/test/MC/Disassembler/ARM64/advsimd.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Disassembler/ARM64/advsimd.txt?rev=207669&r1=207668&r2=207669&view=diff
==============================================================================
--- llvm/trunk/test/MC/Disassembler/ARM64/advsimd.txt (original)
+++ llvm/trunk/test/MC/Disassembler/ARM64/advsimd.txt Wed Apr 30 11:13:34 2014
@@ -568,13 +568,13 @@
0x00 0xf4 0x02 0x6f
-# CHECK: fmov.2d v0, #1.250000e-01
+# CHECK: fmov.2d v0, #0.12500000
0x00 0xf4 0x02 0x0f
0x00 0xf4 0x02 0x4f
-# CHECK: fmov.2s v0, #1.250000e-01
-# CHECK: fmov.4s v0, #1.250000e-01
+# CHECK: fmov.2s v0, #0.12500000
+# CHECK: fmov.4s v0, #0.12500000
0x20 0x14 0x00 0x0f
0x20 0x34 0x00 0x0f
Modified: llvm/trunk/test/MC/Disassembler/ARM64/scalar-fp.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Disassembler/ARM64/scalar-fp.txt?rev=207669&r1=207668&r2=207669&view=diff
==============================================================================
--- llvm/trunk/test/MC/Disassembler/ARM64/scalar-fp.txt (original)
+++ llvm/trunk/test/MC/Disassembler/ARM64/scalar-fp.txt Wed Apr 30 11:13:34 2014
@@ -184,10 +184,10 @@
0x01 0xf0 0x7b 0x1e
0x01 0xf0 0x6b 0x1e
-# CHECK: fmov s1, #1.250000e-01
-# CHECK: fmov d1, #1.250000e-01
-# CHECK: fmov d1, #-4.843750e-01
-# CHECK: fmov d1, #4.843750e-01
+# CHECK: fmov s1, #0.12500000
+# CHECK: fmov d1, #0.12500000
+# CHECK: fmov d1, #-0.48437500
+# CHECK: fmov d1, #0.48437500
0x41 0x40 0x20 0x1e
0x41 0x40 0x60 0x1e
More information about the llvm-commits
mailing list