1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -O2 -mtriple=x86_64-linux-android -mattr=+mmx \
3 ; RUN: -enable-legalize-types-checking | FileCheck %s
4 ; RUN: llc < %s -O2 -mtriple=x86_64-linux-gnu -mattr=+mmx \
5 ; RUN: -enable-legalize-types-checking | FileCheck %s
7 define i32 @TestComp128GT(fp128 %d1, fp128 %d2) {
8 ; CHECK-LABEL: TestComp128GT:
9 ; CHECK: # %bb.0: # %entry
10 ; CHECK-NEXT: pushq %rax
11 ; CHECK-NEXT: .cfi_def_cfa_offset 16
12 ; CHECK-NEXT: callq __gttf2
13 ; CHECK-NEXT: xorl %ecx, %ecx
14 ; CHECK-NEXT: testl %eax, %eax
15 ; CHECK-NEXT: setg %cl
16 ; CHECK-NEXT: movl %ecx, %eax
17 ; CHECK-NEXT: popq %rcx
18 ; CHECK-NEXT: .cfi_def_cfa_offset 8
21 %cmp = fcmp ogt fp128 %d1, %d2
22 %conv = zext i1 %cmp to i32
26 define i32 @TestComp128GE(fp128 %d1, fp128 %d2) {
27 ; CHECK-LABEL: TestComp128GE:
28 ; CHECK: # %bb.0: # %entry
29 ; CHECK-NEXT: pushq %rax
30 ; CHECK-NEXT: .cfi_def_cfa_offset 16
31 ; CHECK-NEXT: callq __getf2
32 ; CHECK-NEXT: xorl %ecx, %ecx
33 ; CHECK-NEXT: testl %eax, %eax
34 ; CHECK-NEXT: setns %cl
35 ; CHECK-NEXT: movl %ecx, %eax
36 ; CHECK-NEXT: popq %rcx
37 ; CHECK-NEXT: .cfi_def_cfa_offset 8
40 %cmp = fcmp oge fp128 %d1, %d2
41 %conv = zext i1 %cmp to i32
45 define i32 @TestComp128LT(fp128 %d1, fp128 %d2) {
46 ; CHECK-LABEL: TestComp128LT:
47 ; CHECK: # %bb.0: # %entry
48 ; CHECK-NEXT: pushq %rax
49 ; CHECK-NEXT: .cfi_def_cfa_offset 16
50 ; CHECK-NEXT: callq __lttf2
51 ; CHECK-NEXT: xorl %ecx, %ecx
52 ; CHECK-NEXT: testl %eax, %eax
53 ; CHECK-NEXT: sets %cl
54 ; CHECK-NEXT: movl %ecx, %eax
55 ; CHECK-NEXT: popq %rcx
56 ; CHECK-NEXT: .cfi_def_cfa_offset 8
59 %cmp = fcmp olt fp128 %d1, %d2
60 %conv = zext i1 %cmp to i32
62 ; FIXME: This used to generate a shrl to move the sign bit of eax into bit 0.
63 ; This no longer happens with fp128 compares being expanded by LegalizeDAG.
64 ; We can add a new DAG combine for X86ISD::CMP/SETCC to restore this.
67 define i32 @TestComp128LE(fp128 %d1, fp128 %d2) {
68 ; CHECK-LABEL: TestComp128LE:
69 ; CHECK: # %bb.0: # %entry
70 ; CHECK-NEXT: pushq %rax
71 ; CHECK-NEXT: .cfi_def_cfa_offset 16
72 ; CHECK-NEXT: callq __letf2
73 ; CHECK-NEXT: xorl %ecx, %ecx
74 ; CHECK-NEXT: testl %eax, %eax
75 ; CHECK-NEXT: setle %cl
76 ; CHECK-NEXT: movl %ecx, %eax
77 ; CHECK-NEXT: popq %rcx
78 ; CHECK-NEXT: .cfi_def_cfa_offset 8
81 %cmp = fcmp ole fp128 %d1, %d2
82 %conv = zext i1 %cmp to i32
86 define i32 @TestComp128EQ(fp128 %d1, fp128 %d2) {
87 ; CHECK-LABEL: TestComp128EQ:
88 ; CHECK: # %bb.0: # %entry
89 ; CHECK-NEXT: pushq %rax
90 ; CHECK-NEXT: .cfi_def_cfa_offset 16
91 ; CHECK-NEXT: callq __eqtf2
92 ; CHECK-NEXT: xorl %ecx, %ecx
93 ; CHECK-NEXT: testl %eax, %eax
94 ; CHECK-NEXT: sete %cl
95 ; CHECK-NEXT: movl %ecx, %eax
96 ; CHECK-NEXT: popq %rcx
97 ; CHECK-NEXT: .cfi_def_cfa_offset 8
100 %cmp = fcmp oeq fp128 %d1, %d2
101 %conv = zext i1 %cmp to i32
105 define i32 @TestComp128NE(fp128 %d1, fp128 %d2) {
106 ; CHECK-LABEL: TestComp128NE:
107 ; CHECK: # %bb.0: # %entry
108 ; CHECK-NEXT: pushq %rax
109 ; CHECK-NEXT: .cfi_def_cfa_offset 16
110 ; CHECK-NEXT: callq __netf2
111 ; CHECK-NEXT: xorl %ecx, %ecx
112 ; CHECK-NEXT: testl %eax, %eax
113 ; CHECK-NEXT: setne %cl
114 ; CHECK-NEXT: movl %ecx, %eax
115 ; CHECK-NEXT: popq %rcx
116 ; CHECK-NEXT: .cfi_def_cfa_offset 8
119 %cmp = fcmp une fp128 %d1, %d2
120 %conv = zext i1 %cmp to i32
124 define fp128 @TestMax(fp128 %x, fp128 %y) {
125 ; CHECK-LABEL: TestMax:
126 ; CHECK: # %bb.0: # %entry
127 ; CHECK-NEXT: subq $40, %rsp
128 ; CHECK-NEXT: .cfi_def_cfa_offset 48
129 ; CHECK-NEXT: movaps %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
130 ; CHECK-NEXT: movaps %xmm1, (%rsp) # 16-byte Spill
131 ; CHECK-NEXT: callq __gttf2
132 ; CHECK-NEXT: movaps {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 16-byte Reload
133 ; CHECK-NEXT: testl %eax, %eax
134 ; CHECK-NEXT: jg .LBB6_2
135 ; CHECK-NEXT: # %bb.1: # %entry
136 ; CHECK-NEXT: movaps (%rsp), %xmm0 # 16-byte Reload
137 ; CHECK-NEXT: .LBB6_2: # %entry
138 ; CHECK-NEXT: addq $40, %rsp
139 ; CHECK-NEXT: .cfi_def_cfa_offset 8
142 %cmp = fcmp ogt fp128 %x, %y
143 %cond = select i1 %cmp, fp128 %x, fp128 %y