1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-23 21:13:02 +02:00
llvm-mirror/test/CodeGen/X86/pr13577.ll
Craig Topper 207263b7e6 [X86][SSE][AVX-512] Convert FAND/FOR/FXOR/FANDN nodes to integer operations if they are available. This will allow a bunch of patterns to be removed.
These nodes are only emitted for lowering FABS/FNEG/FNABS/FCOPYSIGN. Ideally we just wouldn't create these nodes if SSE2 or higher is available, but it was simple to just convert them in DAG combine.

For SSE2, AVX, and AVX512 with DQI this is no functional change as the execution domain fixing pass ensures the right domain is selected regardless of the ISD opcode.

For AVX-512 without DQI we end up using integer instructions since the floating point versions aren't available. But we were already doing that for any logical operations in code that didn't come from FABS/FNEG/FNABS/FCOPYSIGN so this seems no worse. And we get the benefit of being able to fold broadcasts now.

llvm-svn: 290060
2016-12-18 07:54:23 +00:00

44 lines
1.2 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: llc < %s -mtriple=x86_64-darwin | FileCheck %s
; CHECK-LABEL: LCPI0_0:
; CHECK-NEXT: .long 4286578688
; CHECK-LABEL: LCPI0_1:
; CHECK-NEXT: .long 2139095040
define x86_fp80 @foo(x86_fp80 %a) {
; CHECK-LABEL: foo:
; CHECK: ## BB#0:
; CHECK-NEXT: fldt {{[0-9]+}}(%rsp)
; CHECK-NEXT: fstpt -{{[0-9]+}}(%rsp)
; CHECK-NEXT: testb $-128, -{{[0-9]+}}(%rsp)
; CHECK-NEXT: flds LCPI0_0(%rip)
; CHECK-NEXT: flds LCPI0_1(%rip)
; CHECK-NEXT: fcmovne %st(1), %st(0)
; CHECK-NEXT: fstp %st(1)
; CHECK-NEXT: retq
;
%1 = tail call x86_fp80 @copysignl(x86_fp80 0xK7FFF8000000000000000, x86_fp80 %a) nounwind readnone
ret x86_fp80 %1
}
declare x86_fp80 @copysignl(x86_fp80, x86_fp80) nounwind readnone
; This would crash:
; https://llvm.org/bugs/show_bug.cgi?id=26070
define float @pr26070() {
; CHECK-LABEL: pr26070:
; CHECK: ## BB#0:
; CHECK-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
; CHECK-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,0,0,0]
; CHECK-NEXT: orps {{.*}}(%rip), %xmm0
; CHECK-NEXT: retq
;
%c = call float @copysignf(float 1.0, float undef) readnone
ret float %c
}
declare float @copysignf(float, float)