[DAGCombiner] don't dereference an operand that doesn't exist (PR26070)
[oota-llvm.git] / test / CodeGen / X86 / pr13577.ll
1 ; RUN: llc < %s -mtriple=x86_64-darwin | FileCheck %s
2
3 ; CHECK-LABEL: LCPI0_0:
4 ; CHECK-NEXT: .long 4286578688
5 ; CHECK-LABEL: LCPI0_1:
6 ; CHECK-NEXT: .long 2139095040
7
8 ; CHECK-LABEL: foo:
9 ; CHECK: testb $-128, -15(%rsp)
10 ; CHECK: flds LCPI0_0(%rip)
11 ; CHECK: flds LCPI0_1(%rip)
12 ; CHECK: fcmovne %st(1), %st(0)
13 ; CHECK: fstp %st(1)
14 ; CHECK: retq
15 define x86_fp80 @foo(x86_fp80 %a) {
16   %1 = tail call x86_fp80 @copysignl(x86_fp80 0xK7FFF8000000000000000, x86_fp80 %a) nounwind readnone
17   ret x86_fp80 %1
18 }
19
20 declare x86_fp80 @copysignl(x86_fp80, x86_fp80) nounwind readnone
21
22 ; This would crash:
23 ; https://llvm.org/bugs/show_bug.cgi?id=26070
24
25 define float @pr26070() {
26   %c = call float @copysignf(float 1.0, float undef) readnone
27   ret float %c
28
29 ; CHECK-LABEL: pr26070:
30 ; CHECK:       andps
31 ; CHECK-NEXT:  orps
32 ; CHECK-NEXT:  retq
33 }
34
35 declare float @copysignf(float, float)
36