2009-09-26 17:24:17 +02:00
|
|
|
; RUN: llc < %s -march=x86-64 | FileCheck %s
|
|
|
|
|
|
|
|
; Convert oeq and une to ole/oge/ule/uge when comparing with infinity
|
|
|
|
; and negative infinity, because those are more efficient on x86.
|
|
|
|
|
X86: Turn fp selects into mask operations.
double test(double a, double b, double c, double d) { return a<b ? c : d; }
before:
_test:
ucomisd %xmm0, %xmm1
ja LBB0_2
movaps %xmm3, %xmm2
LBB0_2:
movaps %xmm2, %xmm0
after:
_test:
cmpltsd %xmm1, %xmm0
andpd %xmm0, %xmm2
andnpd %xmm3, %xmm0
orpd %xmm2, %xmm0
Small speedup on Benchmarks/SmallPT
llvm-svn: 187706
2013-08-04 14:05:16 +02:00
|
|
|
declare void @f() nounwind
|
|
|
|
|
2013-07-14 08:24:09 +02:00
|
|
|
; CHECK-LABEL: oeq_inff:
|
2009-09-26 17:24:17 +02:00
|
|
|
; CHECK: ucomiss
|
Enable machine sinking critical edge splitting. e.g.
define double @foo(double %x, double %y, i1 %c) nounwind {
%a = fdiv double %x, 3.2
%z = select i1 %c, double %a, double %y
ret double %z
}
Was:
_foo:
divsd LCPI0_0(%rip), %xmm0
testb $1, %dil
jne LBB0_2
movaps %xmm1, %xmm0
LBB0_2:
ret
Now:
_foo:
testb $1, %dil
je LBB0_2
divsd LCPI0_0(%rip), %xmm0
ret
LBB0_2:
movaps %xmm1, %xmm0
ret
This avoids the divsd when early exit is taken.
rdar://8454886
llvm-svn: 114372
2010-09-21 00:52:00 +02:00
|
|
|
; CHECK: jb
|
X86: Turn fp selects into mask operations.
double test(double a, double b, double c, double d) { return a<b ? c : d; }
before:
_test:
ucomisd %xmm0, %xmm1
ja LBB0_2
movaps %xmm3, %xmm2
LBB0_2:
movaps %xmm2, %xmm0
after:
_test:
cmpltsd %xmm1, %xmm0
andpd %xmm0, %xmm2
andnpd %xmm3, %xmm0
orpd %xmm2, %xmm0
Small speedup on Benchmarks/SmallPT
llvm-svn: 187706
2013-08-04 14:05:16 +02:00
|
|
|
define void @oeq_inff(float %x) nounwind {
|
2009-09-26 17:24:17 +02:00
|
|
|
%t0 = fcmp oeq float %x, 0x7FF0000000000000
|
X86: Turn fp selects into mask operations.
double test(double a, double b, double c, double d) { return a<b ? c : d; }
before:
_test:
ucomisd %xmm0, %xmm1
ja LBB0_2
movaps %xmm3, %xmm2
LBB0_2:
movaps %xmm2, %xmm0
after:
_test:
cmpltsd %xmm1, %xmm0
andpd %xmm0, %xmm2
andnpd %xmm3, %xmm0
orpd %xmm2, %xmm0
Small speedup on Benchmarks/SmallPT
llvm-svn: 187706
2013-08-04 14:05:16 +02:00
|
|
|
br i1 %t0, label %true, label %false
|
|
|
|
|
|
|
|
true:
|
|
|
|
call void @f() nounwind
|
|
|
|
br label %false
|
|
|
|
|
|
|
|
false:
|
|
|
|
ret void
|
2009-09-26 17:24:17 +02:00
|
|
|
}
|
|
|
|
|
2013-07-14 08:24:09 +02:00
|
|
|
; CHECK-LABEL: oeq_inf:
|
2009-09-26 17:24:17 +02:00
|
|
|
; CHECK: ucomisd
|
Enable machine sinking critical edge splitting. e.g.
define double @foo(double %x, double %y, i1 %c) nounwind {
%a = fdiv double %x, 3.2
%z = select i1 %c, double %a, double %y
ret double %z
}
Was:
_foo:
divsd LCPI0_0(%rip), %xmm0
testb $1, %dil
jne LBB0_2
movaps %xmm1, %xmm0
LBB0_2:
ret
Now:
_foo:
testb $1, %dil
je LBB0_2
divsd LCPI0_0(%rip), %xmm0
ret
LBB0_2:
movaps %xmm1, %xmm0
ret
This avoids the divsd when early exit is taken.
rdar://8454886
llvm-svn: 114372
2010-09-21 00:52:00 +02:00
|
|
|
; CHECK: jb
|
X86: Turn fp selects into mask operations.
double test(double a, double b, double c, double d) { return a<b ? c : d; }
before:
_test:
ucomisd %xmm0, %xmm1
ja LBB0_2
movaps %xmm3, %xmm2
LBB0_2:
movaps %xmm2, %xmm0
after:
_test:
cmpltsd %xmm1, %xmm0
andpd %xmm0, %xmm2
andnpd %xmm3, %xmm0
orpd %xmm2, %xmm0
Small speedup on Benchmarks/SmallPT
llvm-svn: 187706
2013-08-04 14:05:16 +02:00
|
|
|
define void @oeq_inf(double %x) nounwind {
|
2009-09-26 17:24:17 +02:00
|
|
|
%t0 = fcmp oeq double %x, 0x7FF0000000000000
|
X86: Turn fp selects into mask operations.
double test(double a, double b, double c, double d) { return a<b ? c : d; }
before:
_test:
ucomisd %xmm0, %xmm1
ja LBB0_2
movaps %xmm3, %xmm2
LBB0_2:
movaps %xmm2, %xmm0
after:
_test:
cmpltsd %xmm1, %xmm0
andpd %xmm0, %xmm2
andnpd %xmm3, %xmm0
orpd %xmm2, %xmm0
Small speedup on Benchmarks/SmallPT
llvm-svn: 187706
2013-08-04 14:05:16 +02:00
|
|
|
br i1 %t0, label %true, label %false
|
|
|
|
|
|
|
|
true:
|
|
|
|
call void @f() nounwind
|
|
|
|
br label %false
|
|
|
|
|
|
|
|
false:
|
|
|
|
ret void
|
2009-09-26 17:24:17 +02:00
|
|
|
}
|
|
|
|
|
2013-07-14 08:24:09 +02:00
|
|
|
; CHECK-LABEL: une_inff:
|
2009-09-26 17:24:17 +02:00
|
|
|
; CHECK: ucomiss
|
Enable machine sinking critical edge splitting. e.g.
define double @foo(double %x, double %y, i1 %c) nounwind {
%a = fdiv double %x, 3.2
%z = select i1 %c, double %a, double %y
ret double %z
}
Was:
_foo:
divsd LCPI0_0(%rip), %xmm0
testb $1, %dil
jne LBB0_2
movaps %xmm1, %xmm0
LBB0_2:
ret
Now:
_foo:
testb $1, %dil
je LBB0_2
divsd LCPI0_0(%rip), %xmm0
ret
LBB0_2:
movaps %xmm1, %xmm0
ret
This avoids the divsd when early exit is taken.
rdar://8454886
llvm-svn: 114372
2010-09-21 00:52:00 +02:00
|
|
|
; CHECK: jae
|
X86: Turn fp selects into mask operations.
double test(double a, double b, double c, double d) { return a<b ? c : d; }
before:
_test:
ucomisd %xmm0, %xmm1
ja LBB0_2
movaps %xmm3, %xmm2
LBB0_2:
movaps %xmm2, %xmm0
after:
_test:
cmpltsd %xmm1, %xmm0
andpd %xmm0, %xmm2
andnpd %xmm3, %xmm0
orpd %xmm2, %xmm0
Small speedup on Benchmarks/SmallPT
llvm-svn: 187706
2013-08-04 14:05:16 +02:00
|
|
|
define void @une_inff(float %x) nounwind {
|
2009-09-26 17:24:17 +02:00
|
|
|
%t0 = fcmp une float %x, 0x7FF0000000000000
|
X86: Turn fp selects into mask operations.
double test(double a, double b, double c, double d) { return a<b ? c : d; }
before:
_test:
ucomisd %xmm0, %xmm1
ja LBB0_2
movaps %xmm3, %xmm2
LBB0_2:
movaps %xmm2, %xmm0
after:
_test:
cmpltsd %xmm1, %xmm0
andpd %xmm0, %xmm2
andnpd %xmm3, %xmm0
orpd %xmm2, %xmm0
Small speedup on Benchmarks/SmallPT
llvm-svn: 187706
2013-08-04 14:05:16 +02:00
|
|
|
br i1 %t0, label %true, label %false
|
|
|
|
|
|
|
|
true:
|
|
|
|
call void @f() nounwind
|
|
|
|
br label %false
|
|
|
|
|
|
|
|
false:
|
|
|
|
ret void
|
2009-09-26 17:24:17 +02:00
|
|
|
}
|
|
|
|
|
2013-07-14 08:24:09 +02:00
|
|
|
; CHECK-LABEL: une_inf:
|
2009-09-26 17:24:17 +02:00
|
|
|
; CHECK: ucomisd
|
Enable machine sinking critical edge splitting. e.g.
define double @foo(double %x, double %y, i1 %c) nounwind {
%a = fdiv double %x, 3.2
%z = select i1 %c, double %a, double %y
ret double %z
}
Was:
_foo:
divsd LCPI0_0(%rip), %xmm0
testb $1, %dil
jne LBB0_2
movaps %xmm1, %xmm0
LBB0_2:
ret
Now:
_foo:
testb $1, %dil
je LBB0_2
divsd LCPI0_0(%rip), %xmm0
ret
LBB0_2:
movaps %xmm1, %xmm0
ret
This avoids the divsd when early exit is taken.
rdar://8454886
llvm-svn: 114372
2010-09-21 00:52:00 +02:00
|
|
|
; CHECK: jae
|
X86: Turn fp selects into mask operations.
double test(double a, double b, double c, double d) { return a<b ? c : d; }
before:
_test:
ucomisd %xmm0, %xmm1
ja LBB0_2
movaps %xmm3, %xmm2
LBB0_2:
movaps %xmm2, %xmm0
after:
_test:
cmpltsd %xmm1, %xmm0
andpd %xmm0, %xmm2
andnpd %xmm3, %xmm0
orpd %xmm2, %xmm0
Small speedup on Benchmarks/SmallPT
llvm-svn: 187706
2013-08-04 14:05:16 +02:00
|
|
|
define void @une_inf(double %x) nounwind {
|
2009-09-26 17:24:17 +02:00
|
|
|
%t0 = fcmp une double %x, 0x7FF0000000000000
|
X86: Turn fp selects into mask operations.
double test(double a, double b, double c, double d) { return a<b ? c : d; }
before:
_test:
ucomisd %xmm0, %xmm1
ja LBB0_2
movaps %xmm3, %xmm2
LBB0_2:
movaps %xmm2, %xmm0
after:
_test:
cmpltsd %xmm1, %xmm0
andpd %xmm0, %xmm2
andnpd %xmm3, %xmm0
orpd %xmm2, %xmm0
Small speedup on Benchmarks/SmallPT
llvm-svn: 187706
2013-08-04 14:05:16 +02:00
|
|
|
br i1 %t0, label %true, label %false
|
|
|
|
|
|
|
|
true:
|
|
|
|
call void @f() nounwind
|
|
|
|
br label %false
|
|
|
|
|
|
|
|
false:
|
|
|
|
ret void
|
2009-09-26 17:24:17 +02:00
|
|
|
}
|
|
|
|
|
2013-07-14 08:24:09 +02:00
|
|
|
; CHECK-LABEL: oeq_neg_inff:
|
2009-09-26 17:24:17 +02:00
|
|
|
; CHECK: ucomiss
|
Enable machine sinking critical edge splitting. e.g.
define double @foo(double %x, double %y, i1 %c) nounwind {
%a = fdiv double %x, 3.2
%z = select i1 %c, double %a, double %y
ret double %z
}
Was:
_foo:
divsd LCPI0_0(%rip), %xmm0
testb $1, %dil
jne LBB0_2
movaps %xmm1, %xmm0
LBB0_2:
ret
Now:
_foo:
testb $1, %dil
je LBB0_2
divsd LCPI0_0(%rip), %xmm0
ret
LBB0_2:
movaps %xmm1, %xmm0
ret
This avoids the divsd when early exit is taken.
rdar://8454886
llvm-svn: 114372
2010-09-21 00:52:00 +02:00
|
|
|
; CHECK: jb
|
X86: Turn fp selects into mask operations.
double test(double a, double b, double c, double d) { return a<b ? c : d; }
before:
_test:
ucomisd %xmm0, %xmm1
ja LBB0_2
movaps %xmm3, %xmm2
LBB0_2:
movaps %xmm2, %xmm0
after:
_test:
cmpltsd %xmm1, %xmm0
andpd %xmm0, %xmm2
andnpd %xmm3, %xmm0
orpd %xmm2, %xmm0
Small speedup on Benchmarks/SmallPT
llvm-svn: 187706
2013-08-04 14:05:16 +02:00
|
|
|
define void @oeq_neg_inff(float %x) nounwind {
|
2009-09-26 17:24:17 +02:00
|
|
|
%t0 = fcmp oeq float %x, 0xFFF0000000000000
|
X86: Turn fp selects into mask operations.
double test(double a, double b, double c, double d) { return a<b ? c : d; }
before:
_test:
ucomisd %xmm0, %xmm1
ja LBB0_2
movaps %xmm3, %xmm2
LBB0_2:
movaps %xmm2, %xmm0
after:
_test:
cmpltsd %xmm1, %xmm0
andpd %xmm0, %xmm2
andnpd %xmm3, %xmm0
orpd %xmm2, %xmm0
Small speedup on Benchmarks/SmallPT
llvm-svn: 187706
2013-08-04 14:05:16 +02:00
|
|
|
br i1 %t0, label %true, label %false
|
|
|
|
|
|
|
|
true:
|
|
|
|
call void @f() nounwind
|
|
|
|
br label %false
|
|
|
|
|
|
|
|
false:
|
|
|
|
ret void
|
2009-09-26 17:24:17 +02:00
|
|
|
}
|
|
|
|
|
2013-07-14 08:24:09 +02:00
|
|
|
; CHECK-LABEL: oeq_neg_inf:
|
2009-09-26 17:24:17 +02:00
|
|
|
; CHECK: ucomisd
|
Enable machine sinking critical edge splitting. e.g.
define double @foo(double %x, double %y, i1 %c) nounwind {
%a = fdiv double %x, 3.2
%z = select i1 %c, double %a, double %y
ret double %z
}
Was:
_foo:
divsd LCPI0_0(%rip), %xmm0
testb $1, %dil
jne LBB0_2
movaps %xmm1, %xmm0
LBB0_2:
ret
Now:
_foo:
testb $1, %dil
je LBB0_2
divsd LCPI0_0(%rip), %xmm0
ret
LBB0_2:
movaps %xmm1, %xmm0
ret
This avoids the divsd when early exit is taken.
rdar://8454886
llvm-svn: 114372
2010-09-21 00:52:00 +02:00
|
|
|
; CHECK: jb
|
X86: Turn fp selects into mask operations.
double test(double a, double b, double c, double d) { return a<b ? c : d; }
before:
_test:
ucomisd %xmm0, %xmm1
ja LBB0_2
movaps %xmm3, %xmm2
LBB0_2:
movaps %xmm2, %xmm0
after:
_test:
cmpltsd %xmm1, %xmm0
andpd %xmm0, %xmm2
andnpd %xmm3, %xmm0
orpd %xmm2, %xmm0
Small speedup on Benchmarks/SmallPT
llvm-svn: 187706
2013-08-04 14:05:16 +02:00
|
|
|
define void @oeq_neg_inf(double %x) nounwind {
|
2009-09-26 17:24:17 +02:00
|
|
|
%t0 = fcmp oeq double %x, 0xFFF0000000000000
|
X86: Turn fp selects into mask operations.
double test(double a, double b, double c, double d) { return a<b ? c : d; }
before:
_test:
ucomisd %xmm0, %xmm1
ja LBB0_2
movaps %xmm3, %xmm2
LBB0_2:
movaps %xmm2, %xmm0
after:
_test:
cmpltsd %xmm1, %xmm0
andpd %xmm0, %xmm2
andnpd %xmm3, %xmm0
orpd %xmm2, %xmm0
Small speedup on Benchmarks/SmallPT
llvm-svn: 187706
2013-08-04 14:05:16 +02:00
|
|
|
br i1 %t0, label %true, label %false
|
|
|
|
|
|
|
|
true:
|
|
|
|
call void @f() nounwind
|
|
|
|
br label %false
|
|
|
|
|
|
|
|
false:
|
|
|
|
ret void
|
2009-09-26 17:24:17 +02:00
|
|
|
}
|
|
|
|
|
2013-07-14 08:24:09 +02:00
|
|
|
; CHECK-LABEL: une_neg_inff:
|
2009-09-26 17:24:17 +02:00
|
|
|
; CHECK: ucomiss
|
Enable machine sinking critical edge splitting. e.g.
define double @foo(double %x, double %y, i1 %c) nounwind {
%a = fdiv double %x, 3.2
%z = select i1 %c, double %a, double %y
ret double %z
}
Was:
_foo:
divsd LCPI0_0(%rip), %xmm0
testb $1, %dil
jne LBB0_2
movaps %xmm1, %xmm0
LBB0_2:
ret
Now:
_foo:
testb $1, %dil
je LBB0_2
divsd LCPI0_0(%rip), %xmm0
ret
LBB0_2:
movaps %xmm1, %xmm0
ret
This avoids the divsd when early exit is taken.
rdar://8454886
llvm-svn: 114372
2010-09-21 00:52:00 +02:00
|
|
|
; CHECK: jae
|
X86: Turn fp selects into mask operations.
double test(double a, double b, double c, double d) { return a<b ? c : d; }
before:
_test:
ucomisd %xmm0, %xmm1
ja LBB0_2
movaps %xmm3, %xmm2
LBB0_2:
movaps %xmm2, %xmm0
after:
_test:
cmpltsd %xmm1, %xmm0
andpd %xmm0, %xmm2
andnpd %xmm3, %xmm0
orpd %xmm2, %xmm0
Small speedup on Benchmarks/SmallPT
llvm-svn: 187706
2013-08-04 14:05:16 +02:00
|
|
|
define void @une_neg_inff(float %x) nounwind {
|
2009-09-26 17:24:17 +02:00
|
|
|
%t0 = fcmp une float %x, 0xFFF0000000000000
|
X86: Turn fp selects into mask operations.
double test(double a, double b, double c, double d) { return a<b ? c : d; }
before:
_test:
ucomisd %xmm0, %xmm1
ja LBB0_2
movaps %xmm3, %xmm2
LBB0_2:
movaps %xmm2, %xmm0
after:
_test:
cmpltsd %xmm1, %xmm0
andpd %xmm0, %xmm2
andnpd %xmm3, %xmm0
orpd %xmm2, %xmm0
Small speedup on Benchmarks/SmallPT
llvm-svn: 187706
2013-08-04 14:05:16 +02:00
|
|
|
br i1 %t0, label %true, label %false
|
|
|
|
|
|
|
|
true:
|
|
|
|
call void @f() nounwind
|
|
|
|
br label %false
|
|
|
|
|
|
|
|
false:
|
|
|
|
ret void
|
2009-09-26 17:24:17 +02:00
|
|
|
}
|
|
|
|
|
2013-07-14 08:24:09 +02:00
|
|
|
; CHECK-LABEL: une_neg_inf:
|
2009-09-26 17:24:17 +02:00
|
|
|
; CHECK: ucomisd
|
Enable machine sinking critical edge splitting. e.g.
define double @foo(double %x, double %y, i1 %c) nounwind {
%a = fdiv double %x, 3.2
%z = select i1 %c, double %a, double %y
ret double %z
}
Was:
_foo:
divsd LCPI0_0(%rip), %xmm0
testb $1, %dil
jne LBB0_2
movaps %xmm1, %xmm0
LBB0_2:
ret
Now:
_foo:
testb $1, %dil
je LBB0_2
divsd LCPI0_0(%rip), %xmm0
ret
LBB0_2:
movaps %xmm1, %xmm0
ret
This avoids the divsd when early exit is taken.
rdar://8454886
llvm-svn: 114372
2010-09-21 00:52:00 +02:00
|
|
|
; CHECK: jae
|
X86: Turn fp selects into mask operations.
double test(double a, double b, double c, double d) { return a<b ? c : d; }
before:
_test:
ucomisd %xmm0, %xmm1
ja LBB0_2
movaps %xmm3, %xmm2
LBB0_2:
movaps %xmm2, %xmm0
after:
_test:
cmpltsd %xmm1, %xmm0
andpd %xmm0, %xmm2
andnpd %xmm3, %xmm0
orpd %xmm2, %xmm0
Small speedup on Benchmarks/SmallPT
llvm-svn: 187706
2013-08-04 14:05:16 +02:00
|
|
|
define void @une_neg_inf(double %x) nounwind {
|
2009-09-26 17:24:17 +02:00
|
|
|
%t0 = fcmp une double %x, 0xFFF0000000000000
|
X86: Turn fp selects into mask operations.
double test(double a, double b, double c, double d) { return a<b ? c : d; }
before:
_test:
ucomisd %xmm0, %xmm1
ja LBB0_2
movaps %xmm3, %xmm2
LBB0_2:
movaps %xmm2, %xmm0
after:
_test:
cmpltsd %xmm1, %xmm0
andpd %xmm0, %xmm2
andnpd %xmm3, %xmm0
orpd %xmm2, %xmm0
Small speedup on Benchmarks/SmallPT
llvm-svn: 187706
2013-08-04 14:05:16 +02:00
|
|
|
br i1 %t0, label %true, label %false
|
|
|
|
|
|
|
|
true:
|
|
|
|
call void @f() nounwind
|
|
|
|
br label %false
|
|
|
|
|
|
|
|
false:
|
|
|
|
ret void
|
2009-09-26 17:24:17 +02:00
|
|
|
}
|