Skip to content

Commit 3ae4265

Browse files
committed
Revert "[GlobalIsel][X86] Legalize G_CTPOP and G_CTLZ"
This reverts commit ef1f27d.
1 parent 6c35d42 commit 3ae4265

File tree

6 files changed

+28
-385
lines changed

6 files changed

+28
-385
lines changed

llvm/lib/Target/X86/X86LegalizerInfo.cpp

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ X86LegalizerInfo::X86LegalizerInfo(const X86Subtarget &STI,
6565
setLegalizerInfoSSE1();
6666
setLegalizerInfoSSE2();
6767
setLegalizerInfoSSE41();
68-
setLegalizerInfoSSE42();
6968
setLegalizerInfoAVX();
7069
setLegalizerInfoAVX2();
7170
setLegalizerInfoAVX512();
@@ -287,10 +286,6 @@ void X86LegalizerInfo::setLegalizerInfo64bit() {
287286
LegacyLegalizeActions::Legal);
288287
LegacyInfo.setAction({G_MERGE_VALUES, 1, s128}, LegacyLegalizeActions::Legal);
289288
LegacyInfo.setAction({G_UNMERGE_VALUES, s128}, LegacyLegalizeActions::Legal);
290-
getActionDefinitionsBuilder(G_BSWAP)
291-
.legalFor({s32, s64})
292-
.widenScalarToNextPow2(1, /*Min=*/32)
293-
.clampScalar(0, s32, s64);
294289
}
295290

296291
void X86LegalizerInfo::setLegalizerInfoSSE1() {
@@ -389,28 +384,6 @@ void X86LegalizerInfo::setLegalizerInfoSSE41() {
389384
LegacyInfo.setAction({G_MUL, v4s32}, LegacyLegalizeActions::Legal);
390385
}
391386

392-
void X86LegalizerInfo::setLegalizerInfoSSE42() {
393-
if (!Subtarget.hasSSE42())
394-
return;
395-
396-
const LLT s16 = LLT::scalar(16);
397-
const LLT s32 = LLT::scalar(32);
398-
const LLT s64 = LLT::scalar(64);
399-
400-
// popcount
401-
getActionDefinitionsBuilder(G_CTPOP)
402-
.legalFor({{s16, s16}, {s32, s32}, {s64, s64}})
403-
.widenScalarToNextPow2(1, /*Min=*/16)
404-
.clampScalar(1, s16, s64);
405-
406-
// count leading zeros (LZCNT)
407-
getActionDefinitionsBuilder(G_CTLZ)
408-
.legalFor({{s16, s16}, {s32, s32}, {s64, s64}})
409-
.widenScalarToNextPow2(1, /*Min=*/16)
410-
.clampScalar(1, s16, s64);
411-
}
412-
413-
414387
void X86LegalizerInfo::setLegalizerInfoAVX() {
415388
if (!Subtarget.hasAVX())
416389
return;

llvm/lib/Target/X86/X86LegalizerInfo.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ class X86LegalizerInfo : public LegalizerInfo {
4141
void setLegalizerInfoSSE1();
4242
void setLegalizerInfoSSE2();
4343
void setLegalizerInfoSSE41();
44-
void setLegalizerInfoSSE42();
4544
void setLegalizerInfoAVX();
4645
void setLegalizerInfoAVX2();
4746
void setLegalizerInfoAVX512();

llvm/test/CodeGen/X86/GlobalISel/legalize-bswap.mir

Lines changed: 0 additions & 97 deletions
This file was deleted.

llvm/test/CodeGen/X86/GlobalISel/legalize-constant.mir

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -19,30 +19,30 @@ body: |
1919
bb.1 (%ir-block.0):
2020
; X32-LABEL: name: test_constant
2121
; X32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
22-
; X32-NEXT: $eax = COPY [[C]](s32)
23-
; X32-NEXT: [[C1:%[0-9]+]]:_(s8) = G_CONSTANT i8 8
24-
; X32-NEXT: $al = COPY [[C1]](s8)
25-
; X32-NEXT: [[C2:%[0-9]+]]:_(s16) = G_CONSTANT i16 16
26-
; X32-NEXT: $ax = COPY [[C2]](s16)
27-
; X32-NEXT: [[C3:%[0-9]+]]:_(s32) = G_CONSTANT i32 32
28-
; X32-NEXT: $eax = COPY [[C3]](s32)
29-
; X32-NEXT: [[C4:%[0-9]+]]:_(s32) = G_CONSTANT i32 64
30-
; X32-NEXT: [[C5:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
31-
; X32-NEXT: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[C4]](s32), [[C5]](s32)
32-
; X32-NEXT: $rax = COPY [[MV]](s64)
33-
; X32-NEXT: RET 0
22+
; X32: $eax = COPY [[C]](s32)
23+
; X32: [[C1:%[0-9]+]]:_(s8) = G_CONSTANT i8 8
24+
; X32: $al = COPY [[C1]](s8)
25+
; X32: [[C2:%[0-9]+]]:_(s16) = G_CONSTANT i16 16
26+
; X32: $ax = COPY [[C2]](s16)
27+
; X32: [[C3:%[0-9]+]]:_(s32) = G_CONSTANT i32 32
28+
; X32: $eax = COPY [[C3]](s32)
29+
; X32: [[C4:%[0-9]+]]:_(s32) = G_CONSTANT i32 64
30+
; X32: [[C5:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
31+
; X32: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[C4]](s32), [[C5]](s32)
32+
; X32: $rax = COPY [[MV]](s64)
33+
; X32: RET 0
3434
; X64-LABEL: name: test_constant
3535
; X64: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
36-
; X64-NEXT: $eax = COPY [[C]](s32)
37-
; X64-NEXT: [[C1:%[0-9]+]]:_(s8) = G_CONSTANT i8 8
38-
; X64-NEXT: $al = COPY [[C1]](s8)
39-
; X64-NEXT: [[C2:%[0-9]+]]:_(s16) = G_CONSTANT i16 16
40-
; X64-NEXT: $ax = COPY [[C2]](s16)
41-
; X64-NEXT: [[C3:%[0-9]+]]:_(s32) = G_CONSTANT i32 32
42-
; X64-NEXT: $eax = COPY [[C3]](s32)
43-
; X64-NEXT: [[C4:%[0-9]+]]:_(s64) = G_CONSTANT i64 64
44-
; X64-NEXT: $rax = COPY [[C4]](s64)
45-
; X64-NEXT: RET 0
36+
; X64: $eax = COPY [[C]](s32)
37+
; X64: [[C1:%[0-9]+]]:_(s8) = G_CONSTANT i8 8
38+
; X64: $al = COPY [[C1]](s8)
39+
; X64: [[C2:%[0-9]+]]:_(s16) = G_CONSTANT i16 16
40+
; X64: $ax = COPY [[C2]](s16)
41+
; X64: [[C3:%[0-9]+]]:_(s32) = G_CONSTANT i32 32
42+
; X64: $eax = COPY [[C3]](s32)
43+
; X64: [[C4:%[0-9]+]]:_(s64) = G_CONSTANT i64 64
44+
; X64: $rax = COPY [[C4]](s64)
45+
; X64: RET 0
4646
%0(s1) = G_CONSTANT i1 1
4747
%5:_(s32) = G_ANYEXT %0
4848
$eax = COPY %5
@@ -71,14 +71,14 @@ body: |
7171
7272
; X32-LABEL: name: test_fconstant
7373
; X32: [[C:%[0-9]+]]:_(s32) = G_FCONSTANT float 1.000000e+00
74-
; X32-NEXT: $eax = COPY [[C]](s32)
75-
; X32-NEXT: [[C1:%[0-9]+]]:_(s64) = G_FCONSTANT double 2.000000e+00
76-
; X32-NEXT: $rax = COPY [[C1]](s64)
74+
; X32: $eax = COPY [[C]](s32)
75+
; X32: [[C1:%[0-9]+]]:_(s64) = G_FCONSTANT double 2.000000e+00
76+
; X32: $rax = COPY [[C1]](s64)
7777
; X64-LABEL: name: test_fconstant
7878
; X64: [[C:%[0-9]+]]:_(s32) = G_FCONSTANT float 1.000000e+00
79-
; X64-NEXT: $eax = COPY [[C]](s32)
80-
; X64-NEXT: [[C1:%[0-9]+]]:_(s64) = G_FCONSTANT double 2.000000e+00
81-
; X64-NEXT: $rax = COPY [[C1]](s64)
79+
; X64: $eax = COPY [[C]](s32)
80+
; X64: [[C1:%[0-9]+]]:_(s64) = G_FCONSTANT double 2.000000e+00
81+
; X64: $rax = COPY [[C1]](s64)
8282
%0(s32) = G_FCONSTANT float 1.0
8383
$eax = COPY %0
8484
%1(s64) = G_FCONSTANT double 2.0

llvm/test/CodeGen/X86/GlobalISel/legalize-ctpop.mir

Lines changed: 0 additions & 114 deletions
This file was deleted.

0 commit comments

Comments
 (0)