1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-linux-android -mattr=+mmx -enable-legalize-types-checking | FileCheck %s
5 ; Check that we dont end up with the ""LLVM ERROR: Cannot select" error.
6 ; Additionally ensure that the output code actually put fp128 values in SSE registers.
8 declare fp128 @llvm.fabs.f128(fp128)
9 declare fp128 @llvm.copysign.f128(fp128, fp128)
11 define fp128 @TestSelect(fp128 %a, fp128 %b) {
12 ; CHECK-LABEL: TestSelect:
14 ; CHECK-NEXT: pushq %rbx
15 ; CHECK-NEXT: .cfi_def_cfa_offset 16
16 ; CHECK-NEXT: subq $32, %rsp
17 ; CHECK-NEXT: .cfi_def_cfa_offset 48
18 ; CHECK-NEXT: .cfi_offset %rbx, -16
19 ; CHECK-NEXT: movaps %xmm1, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
20 ; CHECK-NEXT: movaps %xmm0, (%rsp) # 16-byte Spill
21 ; CHECK-NEXT: callq __gttf2@PLT
22 ; CHECK-NEXT: movl %eax, %ebx
23 ; CHECK-NEXT: movaps (%rsp), %xmm0 # 16-byte Reload
24 ; CHECK-NEXT: movaps {{[-0-9]+}}(%r{{[sb]}}p), %xmm1 # 16-byte Reload
25 ; CHECK-NEXT: callq __subtf3@PLT
26 ; CHECK-NEXT: testl %ebx, %ebx
27 ; CHECK-NEXT: jg .LBB0_2
28 ; CHECK-NEXT: # %bb.1:
29 ; CHECK-NEXT: xorps %xmm0, %xmm0
30 ; CHECK-NEXT: .LBB0_2:
31 ; CHECK-NEXT: addq $32, %rsp
32 ; CHECK-NEXT: .cfi_def_cfa_offset 16
33 ; CHECK-NEXT: popq %rbx
34 ; CHECK-NEXT: .cfi_def_cfa_offset 8
36 %cmp = fcmp ogt fp128 %a, %b
37 %sub = fsub fp128 %a, %b
38 %res = select i1 %cmp, fp128 %sub, fp128 0xL00000000000000000000000000000000
42 define fp128 @TestFabs(fp128 %a) {
43 ; CHECK-LABEL: TestFabs:
45 ; CHECK-NEXT: andps {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
47 %res = call fp128 @llvm.fabs.f128(fp128 %a)
51 define fp128 @TestCopysign(fp128 %a, fp128 %b) {
52 ; CHECK-LABEL: TestCopysign:
54 ; CHECK-NEXT: andps {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1
55 ; CHECK-NEXT: andps {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
56 ; CHECK-NEXT: orps %xmm1, %xmm0
58 %res = call fp128 @llvm.copysign.f128(fp128 %a, fp128 %b)
62 define fp128 @TestFneg(fp128 %a) {
63 ; CHECK-LABEL: TestFneg:
65 ; CHECK-NEXT: pushq %rax
66 ; CHECK-NEXT: .cfi_def_cfa_offset 16
67 ; CHECK-NEXT: movaps %xmm0, %xmm1
68 ; CHECK-NEXT: callq __multf3@PLT
69 ; CHECK-NEXT: xorps {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
70 ; CHECK-NEXT: popq %rax
71 ; CHECK-NEXT: .cfi_def_cfa_offset 8
73 %mul = fmul fp128 %a, %a
74 %res = fsub fp128 0xL00000000000000008000000000000000, %mul