diff options
Diffstat (limited to 'llvm/lib/Target/X86/X86LegalizerInfo.cpp')
-rw-r--r-- | llvm/lib/Target/X86/X86LegalizerInfo.cpp | 39 |
1 files changed, 34 insertions, 5 deletions
diff --git a/llvm/lib/Target/X86/X86LegalizerInfo.cpp b/llvm/lib/Target/X86/X86LegalizerInfo.cpp index 4e94e45af64..bda657946f7 100644 --- a/llvm/lib/Target/X86/X86LegalizerInfo.cpp +++ b/llvm/lib/Target/X86/X86LegalizerInfo.cpp @@ -37,13 +37,24 @@ X86LegalizerInfo::X86LegalizerInfo(const X86Subtarget &STI) : Subtarget(STI) { void X86LegalizerInfo::setLegalizerInfo32bit() { + if (Subtarget.is64Bit()) + return; + + const LLT p0 = LLT::pointer(0, 32); const LLT s8 = LLT::scalar(8); const LLT s16 = LLT::scalar(16); const LLT s32 = LLT::scalar(32); - for (auto Ty : {s8, s16, s32}) { - setAction({G_ADD, Ty}, Legal); - setAction({G_SUB, Ty}, Legal); + for (unsigned BinOp : {G_ADD, G_SUB}) + for (auto Ty : {s8, s16, s32}) + setAction({BinOp, Ty}, Legal); + + for (unsigned MemOp : {G_LOAD, G_STORE}) { + for (auto Ty : {s8, s16, s32, p0}) + setAction({MemOp, Ty}, Legal); + + // And everything's fine in addrspace 0. + setAction({MemOp, 1, p0}, Legal); } } @@ -52,10 +63,23 @@ void X86LegalizerInfo::setLegalizerInfo64bit() { if (!Subtarget.is64Bit()) return; + const LLT p0 = LLT::pointer(0, 64); + const LLT s8 = LLT::scalar(8); + const LLT s16 = LLT::scalar(16); + const LLT s32 = LLT::scalar(32); const LLT s64 = LLT::scalar(64); - setAction({G_ADD, s64}, Legal); - setAction({G_SUB, s64}, Legal); + for (unsigned BinOp : {G_ADD, G_SUB}) + for (auto Ty : {s8, s16, s32, s64}) + setAction({BinOp, Ty}, Legal); + + for (unsigned MemOp : {G_LOAD, G_STORE}) { + for (auto Ty : {s8, s16, s32, s64, p0}) + setAction({MemOp, Ty}, Legal); + + // And everything's fine in addrspace 0. + setAction({MemOp, 1, p0}, Legal); + } } void X86LegalizerInfo::setLegalizerInfoSSE1() { @@ -64,10 +88,15 @@ void X86LegalizerInfo::setLegalizerInfoSSE1() { const LLT s32 = LLT::scalar(32); const LLT v4s32 = LLT::vector(4, 32); + const LLT v2s64 = LLT::vector(2, 64); for (unsigned BinOp : {G_FADD, G_FSUB, G_FMUL, G_FDIV}) for (auto Ty : {s32, v4s32}) setAction({BinOp, Ty}, Legal); + + for (unsigned MemOp : {G_LOAD, G_STORE}) + for (auto Ty : {v4s32, v2s64}) + setAction({MemOp, Ty}, Legal); } void X86LegalizerInfo::setLegalizerInfoSSE2() { |