1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -O2 -mtriple=x86_64-linux-android -mattr=+sse \
3 ; RUN: -enable-legalize-types-checking | FileCheck %s --check-prefix=SSE
4 ; RUN: llc < %s -O2 -mtriple=x86_64-linux-gnu -mattr=+sse \
5 ; RUN: -enable-legalize-types-checking | FileCheck %s --check-prefix=SSE
6 ; RUN: llc < %s -O2 -mtriple=x86_64-linux-android -mattr=-sse \
7 ; RUN: -enable-legalize-types-checking | FileCheck %s --check-prefix=NOSSE
8 ; RUN: llc < %s -O2 -mtriple=x86_64-linux-gnu -mattr=-sse \
9 ; RUN: -enable-legalize-types-checking | FileCheck %s --check-prefix=NOSSE
11 define void @test_select(ptr %p, ptr %q, i1 zeroext %c) {
12 ; SSE-LABEL: test_select:
14 ; SSE-NEXT: testl %edx, %edx
15 ; SSE-NEXT: jne .LBB0_1
17 ; SSE-NEXT: movaps {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
18 ; SSE-NEXT: movaps %xmm0, (%rsi)
21 ; SSE-NEXT: movups (%rdi), %xmm0
22 ; SSE-NEXT: movaps %xmm0, (%rsi)
25 ; NOSSE-LABEL: test_select:
27 ; NOSSE-NEXT: xorl %eax, %eax
28 ; NOSSE-NEXT: testl %edx, %edx
29 ; NOSSE-NEXT: cmovneq (%rdi), %rax
30 ; NOSSE-NEXT: movabsq $9223231299366420480, %rcx # imm = 0x7FFF800000000000
31 ; NOSSE-NEXT: cmovneq 8(%rdi), %rcx
32 ; NOSSE-NEXT: movq %rcx, 8(%rsi)
33 ; NOSSE-NEXT: movq %rax, (%rsi)
35 %a = load fp128, ptr %p, align 2
36 %r = select i1 %c, fp128 %a, fp128 0xL00000000000000007FFF800000000000
37 store fp128 %r, ptr %q
41 ; The uitofp will become a select_cc. This used to crash during type
42 ; legalization because we didn't expect the operands to need to be softened.
43 define fp128 @test_select_cc(fp128, fp128) {
44 ; SSE-LABEL: test_select_cc:
45 ; SSE: # %bb.0: # %BB0
46 ; SSE-NEXT: pushq %rbx
47 ; SSE-NEXT: .cfi_def_cfa_offset 16
48 ; SSE-NEXT: subq $32, %rsp
49 ; SSE-NEXT: .cfi_def_cfa_offset 48
50 ; SSE-NEXT: .cfi_offset %rbx, -16
51 ; SSE-NEXT: movaps %xmm1, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
52 ; SSE-NEXT: movaps %xmm0, (%rsp) # 16-byte Spill
53 ; SSE-NEXT: callq __netf2@PLT
54 ; SSE-NEXT: movl %eax, %ebx
55 ; SSE-NEXT: movaps (%rsp), %xmm0 # 16-byte Reload
56 ; SSE-NEXT: movaps {{[-0-9]+}}(%r{{[sb]}}p), %xmm1 # 16-byte Reload
57 ; SSE-NEXT: callq __eqtf2@PLT
58 ; SSE-NEXT: testl %eax, %eax
59 ; SSE-NEXT: je .LBB1_1
60 ; SSE-NEXT: # %bb.2: # %BB0
61 ; SSE-NEXT: xorps %xmm1, %xmm1
62 ; SSE-NEXT: jmp .LBB1_3
64 ; SSE-NEXT: movaps {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1
65 ; SSE-NEXT: .LBB1_3: # %BB0
66 ; SSE-NEXT: testl %ebx, %ebx
67 ; SSE-NEXT: movaps (%rsp), %xmm0 # 16-byte Reload
68 ; SSE-NEXT: jne .LBB1_5
69 ; SSE-NEXT: # %bb.4: # %BB1
70 ; SSE-NEXT: movaps %xmm1, %xmm0
71 ; SSE-NEXT: .LBB1_5: # %BB2
72 ; SSE-NEXT: addq $32, %rsp
73 ; SSE-NEXT: .cfi_def_cfa_offset 16
75 ; SSE-NEXT: .cfi_def_cfa_offset 8
78 ; NOSSE-LABEL: test_select_cc:
79 ; NOSSE: # %bb.0: # %BB0
80 ; NOSSE-NEXT: pushq %rbp
81 ; NOSSE-NEXT: .cfi_def_cfa_offset 16
82 ; NOSSE-NEXT: pushq %r15
83 ; NOSSE-NEXT: .cfi_def_cfa_offset 24
84 ; NOSSE-NEXT: pushq %r14
85 ; NOSSE-NEXT: .cfi_def_cfa_offset 32
86 ; NOSSE-NEXT: pushq %r12
87 ; NOSSE-NEXT: .cfi_def_cfa_offset 40
88 ; NOSSE-NEXT: pushq %rbx
89 ; NOSSE-NEXT: .cfi_def_cfa_offset 48
90 ; NOSSE-NEXT: .cfi_offset %rbx, -48
91 ; NOSSE-NEXT: .cfi_offset %r12, -40
92 ; NOSSE-NEXT: .cfi_offset %r14, -32
93 ; NOSSE-NEXT: .cfi_offset %r15, -24
94 ; NOSSE-NEXT: .cfi_offset %rbp, -16
95 ; NOSSE-NEXT: movq %rcx, %r15
96 ; NOSSE-NEXT: movq %rdx, %r12
97 ; NOSSE-NEXT: movq %rsi, %rbx
98 ; NOSSE-NEXT: movq %rdi, %r14
99 ; NOSSE-NEXT: callq __netf2@PLT
100 ; NOSSE-NEXT: movl %eax, %ebp
101 ; NOSSE-NEXT: movq %r14, %rdi
102 ; NOSSE-NEXT: movq %rbx, %rsi
103 ; NOSSE-NEXT: movq %r12, %rdx
104 ; NOSSE-NEXT: movq %r15, %rcx
105 ; NOSSE-NEXT: callq __eqtf2@PLT
106 ; NOSSE-NEXT: movl %eax, %ecx
107 ; NOSSE-NEXT: xorl %eax, %eax
108 ; NOSSE-NEXT: testl %ecx, %ecx
109 ; NOSSE-NEXT: movabsq $4611404543450677248, %rdx # imm = 0x3FFF000000000000
110 ; NOSSE-NEXT: cmovneq %rax, %rdx
111 ; NOSSE-NEXT: testl %ebp, %ebp
112 ; NOSSE-NEXT: je .LBB1_2
113 ; NOSSE-NEXT: # %bb.1:
114 ; NOSSE-NEXT: movq %r14, %rax
115 ; NOSSE-NEXT: movq %rbx, %rdx
116 ; NOSSE-NEXT: .LBB1_2: # %BB2
117 ; NOSSE-NEXT: popq %rbx
118 ; NOSSE-NEXT: .cfi_def_cfa_offset 40
119 ; NOSSE-NEXT: popq %r12
120 ; NOSSE-NEXT: .cfi_def_cfa_offset 32
121 ; NOSSE-NEXT: popq %r14
122 ; NOSSE-NEXT: .cfi_def_cfa_offset 24
123 ; NOSSE-NEXT: popq %r15
124 ; NOSSE-NEXT: .cfi_def_cfa_offset 16
125 ; NOSSE-NEXT: popq %rbp
126 ; NOSSE-NEXT: .cfi_def_cfa_offset 8
129 %a = fcmp oeq fp128 %0, %1
130 %b = uitofp i1 %a to fp128
131 br i1 %a, label %BB1, label %BB2
135 %c = phi fp128 [ %0, %BB0 ], [ %b, %BB1 ]