From 68d238801ccc180ecfc92e20174a5ca268ca2d6e Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Tue, 3 Oct 2006 17:27:58 +0000 Subject: [PATCH] Implement floating point constants llvm-svn: 30704 --- llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp | 3 +++ llvm/lib/Target/ARM/ARMInstrInfo.td | 4 ++++ llvm/lib/Target/ARM/README.txt | 4 ++++ llvm/test/Regression/CodeGen/ARM/fp.ll | 9 ++++++++- 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp b/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp index e4b591d67523..2adf4073ba02 100644 --- a/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp +++ b/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp @@ -61,6 +61,9 @@ ARMTargetLowering::ARMTargetLowering(TargetMachine &TM) setOperationAction(ISD::VASTART, MVT::Other, Custom); setOperationAction(ISD::VAEND, MVT::Other, Expand); + setOperationAction(ISD::ConstantFP, MVT::f64, Expand); + setOperationAction(ISD::ConstantFP, MVT::f32, Expand); + setSchedulingPreference(SchedulingForRegPressure); computeRegisterProperties(); } diff --git a/llvm/lib/Target/ARM/ARMInstrInfo.td b/llvm/lib/Target/ARM/ARMInstrInfo.td index d7c096f37b25..55128de930d5 100644 --- a/llvm/lib/Target/ARM/ARMInstrInfo.td +++ b/llvm/lib/Target/ARM/ARMInstrInfo.td @@ -100,6 +100,10 @@ def ldr : InstARM<(ops IntRegs:$dst, memri:$addr), "ldr $dst, $addr", [(set IntRegs:$dst, (load iaddr:$addr))]>; +def FLDS : InstARM<(ops FPRegs:$dst, IntRegs:$addr), + "flds $dst, $addr", + [(set FPRegs:$dst, (load IntRegs:$addr))]>; + def str : InstARM<(ops IntRegs:$src, memri:$addr), "str $src, $addr", [(store IntRegs:$src, iaddr:$addr)]>; diff --git a/llvm/lib/Target/ARM/README.txt b/llvm/lib/Target/ARM/README.txt index 736d776fd876..ae94b8f6bfe1 100644 --- a/llvm/lib/Target/ARM/README.txt +++ b/llvm/lib/Target/ARM/README.txt @@ -28,3 +28,7 @@ mov r1, r1, lsl r2 add r0, r1, r0 ---------------------------------------------------------- + +add an offset to FLDS addressing mode + +---------------------------------------------------------- diff --git a/llvm/test/Regression/CodeGen/ARM/fp.ll b/llvm/test/Regression/CodeGen/ARM/fp.ll index af5a69642c44..3cf45fcddb2b 100644 --- a/llvm/test/Regression/CodeGen/ARM/fp.ll +++ b/llvm/test/Regression/CodeGen/ARM/fp.ll @@ -3,7 +3,9 @@ ; RUN: llvm-as < %s | llc -march=arm | grep fsitos && ; RUN: llvm-as < %s | llc -march=arm | grep fmrs && ; RUN: llvm-as < %s | llc -march=arm | grep fsitod && -; RUN: llvm-as < %s | llc -march=arm | grep fmrrd +; RUN: llvm-as < %s | llc -march=arm | grep fmrrd && +; RUN: llvm-as < %s | llc -march=arm | grep flds && +; RUN: llvm-as < %s | llc -march=arm | grep ".word.*1065353216" float %f(int %a) { entry: @@ -16,3 +18,8 @@ entry: %tmp = cast int %a to double ; [#uses=1] ret double %tmp } + +float %h() { +entry: + ret float 1.000000e+00 +}