[PATCH] D33212: AMDGPU/GlobalISel: Mark 32-bit float constants as legal
Tom Stellard via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 26 09:40:19 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL304003: AMDGPU/GlobalISel: Mark 32-bit float constants as legal (authored by tstellar).
Changed prior to commit:
https://reviews.llvm.org/D33212?vs=99060&id=100425#toc
Repository:
rL LLVM
https://reviews.llvm.org/D33212
Files:
llvm/trunk/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
llvm/trunk/lib/Target/AMDGPU/SIInstrInfo.cpp
llvm/trunk/test/CodeGen/AMDGPU/GlobalISel/legalize-constant.mir
Index: llvm/trunk/lib/Target/AMDGPU/SIInstrInfo.cpp
===================================================================
--- llvm/trunk/lib/Target/AMDGPU/SIInstrInfo.cpp
+++ llvm/trunk/lib/Target/AMDGPU/SIInstrInfo.cpp
@@ -2331,6 +2331,10 @@
bool SIInstrInfo::verifyInstruction(const MachineInstr &MI,
StringRef &ErrInfo) const {
uint16_t Opcode = MI.getOpcode();
+
+ if (SIInstrInfo::isGenericOpcode(MI.getOpcode()))
+ return true;
+
const MachineRegisterInfo &MRI = MI.getParent()->getParent()->getRegInfo();
int Src0Idx = AMDGPU::getNamedOperandIdx(Opcode, AMDGPU::OpName::src0);
int Src1Idx = AMDGPU::getNamedOperandIdx(Opcode, AMDGPU::OpName::src1);
Index: llvm/trunk/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
===================================================================
--- llvm/trunk/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
+++ llvm/trunk/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
@@ -36,6 +36,8 @@
setAction({G_CONSTANT, S32}, Legal);
setAction({G_CONSTANT, S64}, Legal);
+ setAction({G_FCONSTANT, S32}, Legal);
+
setAction({G_GEP, P1}, Legal);
setAction({G_GEP, P2}, Legal);
setAction({G_GEP, 1, S64}, Legal);
Index: llvm/trunk/test/CodeGen/AMDGPU/GlobalISel/legalize-constant.mir
===================================================================
--- llvm/trunk/test/CodeGen/AMDGPU/GlobalISel/legalize-constant.mir
+++ llvm/trunk/test/CodeGen/AMDGPU/GlobalISel/legalize-constant.mir
@@ -5,6 +5,11 @@
entry:
ret void
}
+
+ define void @test_fconstant() {
+ entry:
+ ret void
+ }
...
---
@@ -18,3 +23,18 @@
%0(s32) = G_CONSTANT i32 5
...
+
+---
+name: test_fconstant
+registers:
+ - { id: 0, class: _ }
+ - { id: 1, class: _ }
+body: |
+ bb.0.entry:
+ ; CHECK-LABEL: name: test_fconstant
+ ; CHECK: %0(s32) = G_FCONSTANT float 1.000000e+00
+ ; CHECK: %1(s32) = G_FCONSTANT float 7.5
+
+ %0(s32) = G_FCONSTANT float 1.0
+ %1(s32) = G_FCONSTANT float 7.5
+...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33212.100425.patch
Type: text/x-patch
Size: 2007 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170526/2771eaae/attachment.bin>
More information about the llvm-commits
mailing list