Skip to content

Commit

Permalink
[X86][GlobalISel] Add legalization of 64-bit G_ICMP for i686 (#69478)
Browse files Browse the repository at this point in the history
  • Loading branch information
e-kud committed Oct 25, 2023
1 parent 3c2203a commit 0a8f54c
Show file tree
Hide file tree
Showing 4 changed files with 726 additions and 334 deletions.
4 changes: 3 additions & 1 deletion llvm/lib/Target/X86/GISel/X86LegalizerInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,9 @@ X86LegalizerInfo::X86LegalizerInfo(const X86Subtarget &STI,

getActionDefinitionsBuilder(G_ICMP)
.legalForCartesianProduct({s8}, Is64Bit ? IntTypes64 : IntTypes32)
.clampScalar(0, s8, s8);
.clampScalar(0, s8, s8)
.clampScalar(1, s8, sMaxScalar)
.scalarSameSizeAs(2, 1);

// bswap
getActionDefinitionsBuilder(G_BSWAP)
Expand Down
172 changes: 0 additions & 172 deletions llvm/test/CodeGen/X86/GlobalISel/cmp.ll

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -1276,164 +1276,3 @@ define zeroext i1 @fcmp_une3(float %x) {
%1 = fcmp une float %x, 0.000000e+00
ret i1 %1
}

define zeroext i1 @icmp_eq2(i32 %x) {
; SDAG-LABEL: icmp_eq2:
; SDAG: ## %bb.0:
; SDAG-NEXT: movb $1, %al
; SDAG-NEXT: retq
;
; FAST-LABEL: icmp_eq2:
; FAST: ## %bb.0:
; FAST-NEXT: movb $1, %al
; FAST-NEXT: andb $1, %al
; FAST-NEXT: movzbl %al, %eax
; FAST-NEXT: retq
%1 = icmp eq i32 %x, %x
ret i1 %1
}

define zeroext i1 @icmp_ne2(i32 %x) {
; SDAG-LABEL: icmp_ne2:
; SDAG: ## %bb.0:
; SDAG-NEXT: xorl %eax, %eax
; SDAG-NEXT: retq
;
; FAST-LABEL: icmp_ne2:
; FAST: ## %bb.0:
; FAST-NEXT: xorl %eax, %eax
; FAST-NEXT: andb $1, %al
; FAST-NEXT: movzbl %al, %eax
; FAST-NEXT: retq
%1 = icmp ne i32 %x, %x
ret i1 %1
}

define zeroext i1 @icmp_ugt2(i32 %x) {
; SDAG-LABEL: icmp_ugt2:
; SDAG: ## %bb.0:
; SDAG-NEXT: xorl %eax, %eax
; SDAG-NEXT: retq
;
; FAST-LABEL: icmp_ugt2:
; FAST: ## %bb.0:
; FAST-NEXT: xorl %eax, %eax
; FAST-NEXT: andb $1, %al
; FAST-NEXT: movzbl %al, %eax
; FAST-NEXT: retq
%1 = icmp ugt i32 %x, %x
ret i1 %1
}

define zeroext i1 @icmp_uge2(i32 %x) {
; SDAG-LABEL: icmp_uge2:
; SDAG: ## %bb.0:
; SDAG-NEXT: movb $1, %al
; SDAG-NEXT: retq
;
; FAST-LABEL: icmp_uge2:
; FAST: ## %bb.0:
; FAST-NEXT: movb $1, %al
; FAST-NEXT: andb $1, %al
; FAST-NEXT: movzbl %al, %eax
; FAST-NEXT: retq
%1 = icmp uge i32 %x, %x
ret i1 %1
}

define zeroext i1 @icmp_ult2(i32 %x) {
; SDAG-LABEL: icmp_ult2:
; SDAG: ## %bb.0:
; SDAG-NEXT: xorl %eax, %eax
; SDAG-NEXT: retq
;
; FAST-LABEL: icmp_ult2:
; FAST: ## %bb.0:
; FAST-NEXT: xorl %eax, %eax
; FAST-NEXT: andb $1, %al
; FAST-NEXT: movzbl %al, %eax
; FAST-NEXT: retq
%1 = icmp ult i32 %x, %x
ret i1 %1
}

define zeroext i1 @icmp_ule2(i32 %x) {
; SDAG-LABEL: icmp_ule2:
; SDAG: ## %bb.0:
; SDAG-NEXT: movb $1, %al
; SDAG-NEXT: retq
;
; FAST-LABEL: icmp_ule2:
; FAST: ## %bb.0:
; FAST-NEXT: movb $1, %al
; FAST-NEXT: andb $1, %al
; FAST-NEXT: movzbl %al, %eax
; FAST-NEXT: retq
%1 = icmp ule i32 %x, %x
ret i1 %1
}

define zeroext i1 @icmp_sgt2(i32 %x) {
; SDAG-LABEL: icmp_sgt2:
; SDAG: ## %bb.0:
; SDAG-NEXT: xorl %eax, %eax
; SDAG-NEXT: retq
;
; FAST-LABEL: icmp_sgt2:
; FAST: ## %bb.0:
; FAST-NEXT: xorl %eax, %eax
; FAST-NEXT: andb $1, %al
; FAST-NEXT: movzbl %al, %eax
; FAST-NEXT: retq
%1 = icmp sgt i32 %x, %x
ret i1 %1
}

define zeroext i1 @icmp_sge2(i32 %x) {
; SDAG-LABEL: icmp_sge2:
; SDAG: ## %bb.0:
; SDAG-NEXT: movb $1, %al
; SDAG-NEXT: retq
;
; FAST-LABEL: icmp_sge2:
; FAST: ## %bb.0:
; FAST-NEXT: movb $1, %al
; FAST-NEXT: andb $1, %al
; FAST-NEXT: movzbl %al, %eax
; FAST-NEXT: retq
%1 = icmp sge i32 %x, %x
ret i1 %1
}

define zeroext i1 @icmp_slt2(i32 %x) {
; SDAG-LABEL: icmp_slt2:
; SDAG: ## %bb.0:
; SDAG-NEXT: xorl %eax, %eax
; SDAG-NEXT: retq
;
; FAST-LABEL: icmp_slt2:
; FAST: ## %bb.0:
; FAST-NEXT: xorl %eax, %eax
; FAST-NEXT: andb $1, %al
; FAST-NEXT: movzbl %al, %eax
; FAST-NEXT: retq
%1 = icmp slt i32 %x, %x
ret i1 %1
}

define zeroext i1 @icmp_sle2(i32 %x) {
; SDAG-LABEL: icmp_sle2:
; SDAG: ## %bb.0:
; SDAG-NEXT: movb $1, %al
; SDAG-NEXT: retq
;
; FAST-LABEL: icmp_sle2:
; FAST: ## %bb.0:
; FAST-NEXT: movb $1, %al
; FAST-NEXT: andb $1, %al
; FAST-NEXT: movzbl %al, %eax
; FAST-NEXT: retq
%1 = icmp sle i32 %x, %x
ret i1 %1
}

0 comments on commit 0a8f54c

Please sign in to comment.