1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -O2 -mtriple=x86_64-linux-android -mattr=+mmx | FileCheck %s 2*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -O2 -mtriple=x86_64-linux-gnu -mattr=+mmx | FileCheck %s 3*9880d681SAndroid Build Coastguard Worker 4*9880d681SAndroid Build Coastguard Workerdefine i32 @TestComp128GT(fp128 %d1, fp128 %d2) { 5*9880d681SAndroid Build Coastguard Workerentry: 6*9880d681SAndroid Build Coastguard Worker %cmp = fcmp ogt fp128 %d1, %d2 7*9880d681SAndroid Build Coastguard Worker %conv = zext i1 %cmp to i32 8*9880d681SAndroid Build Coastguard Worker ret i32 %conv 9*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: TestComp128GT: 10*9880d681SAndroid Build Coastguard Worker; CHECK: callq __gttf2 11*9880d681SAndroid Build Coastguard Worker; CHECK: xorl %ecx, %ecx 12*9880d681SAndroid Build Coastguard Worker; CHECK: setg %cl 13*9880d681SAndroid Build Coastguard Worker; CHECK: movl %ecx, %eax 14*9880d681SAndroid Build Coastguard Worker; CHECK: retq 15*9880d681SAndroid Build Coastguard Worker} 16*9880d681SAndroid Build Coastguard Worker 17*9880d681SAndroid Build Coastguard Workerdefine i32 @TestComp128GE(fp128 %d1, fp128 %d2) { 18*9880d681SAndroid Build Coastguard Workerentry: 19*9880d681SAndroid Build Coastguard Worker %cmp = fcmp oge fp128 %d1, %d2 20*9880d681SAndroid Build Coastguard Worker %conv = zext i1 %cmp to i32 21*9880d681SAndroid Build Coastguard Worker ret i32 %conv 22*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: TestComp128GE: 23*9880d681SAndroid Build Coastguard Worker; CHECK: callq __getf2 24*9880d681SAndroid Build Coastguard Worker; CHECK: xorl %ecx, %ecx 25*9880d681SAndroid Build Coastguard Worker; CHECK: testl %eax, %eax 26*9880d681SAndroid Build Coastguard Worker; CHECK: setns %cl 27*9880d681SAndroid Build Coastguard Worker; CHECK: movl %ecx, %eax 28*9880d681SAndroid Build Coastguard Worker; CHECK: retq 29*9880d681SAndroid Build Coastguard Worker} 30*9880d681SAndroid Build Coastguard Worker 31*9880d681SAndroid Build Coastguard Workerdefine i32 @TestComp128LT(fp128 %d1, fp128 %d2) { 32*9880d681SAndroid Build Coastguard Workerentry: 33*9880d681SAndroid Build Coastguard Worker %cmp = fcmp olt fp128 %d1, %d2 34*9880d681SAndroid Build Coastguard Worker %conv = zext i1 %cmp to i32 35*9880d681SAndroid Build Coastguard Worker ret i32 %conv 36*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: TestComp128LT: 37*9880d681SAndroid Build Coastguard Worker; CHECK: callq __lttf2 38*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: shrl $31, %eax 39*9880d681SAndroid Build Coastguard Worker; CHECK: retq 40*9880d681SAndroid Build Coastguard Worker; 41*9880d681SAndroid Build Coastguard Worker; The 'shrl' is a special optimization in llvm to combine 42*9880d681SAndroid Build Coastguard Worker; the effect of 'fcmp olt' and 'zext'. The main purpose is 43*9880d681SAndroid Build Coastguard Worker; to test soften call to __lttf2. 44*9880d681SAndroid Build Coastguard Worker} 45*9880d681SAndroid Build Coastguard Worker 46*9880d681SAndroid Build Coastguard Workerdefine i32 @TestComp128LE(fp128 %d1, fp128 %d2) { 47*9880d681SAndroid Build Coastguard Workerentry: 48*9880d681SAndroid Build Coastguard Worker %cmp = fcmp ole fp128 %d1, %d2 49*9880d681SAndroid Build Coastguard Worker %conv = zext i1 %cmp to i32 50*9880d681SAndroid Build Coastguard Worker ret i32 %conv 51*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: TestComp128LE: 52*9880d681SAndroid Build Coastguard Worker; CHECK: callq __letf2 53*9880d681SAndroid Build Coastguard Worker; CHECK: xorl %ecx, %ecx 54*9880d681SAndroid Build Coastguard Worker; CHECK: testl %eax, %eax 55*9880d681SAndroid Build Coastguard Worker; CHECK: setle %cl 56*9880d681SAndroid Build Coastguard Worker; CHECK: movl %ecx, %eax 57*9880d681SAndroid Build Coastguard Worker; CHECK: retq 58*9880d681SAndroid Build Coastguard Worker} 59*9880d681SAndroid Build Coastguard Worker 60*9880d681SAndroid Build Coastguard Workerdefine i32 @TestComp128EQ(fp128 %d1, fp128 %d2) { 61*9880d681SAndroid Build Coastguard Workerentry: 62*9880d681SAndroid Build Coastguard Worker %cmp = fcmp oeq fp128 %d1, %d2 63*9880d681SAndroid Build Coastguard Worker %conv = zext i1 %cmp to i32 64*9880d681SAndroid Build Coastguard Worker ret i32 %conv 65*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: TestComp128EQ: 66*9880d681SAndroid Build Coastguard Worker; CHECK: callq __eqtf2 67*9880d681SAndroid Build Coastguard Worker; CHECK: xorl %ecx, %ecx 68*9880d681SAndroid Build Coastguard Worker; CHECK: testl %eax, %eax 69*9880d681SAndroid Build Coastguard Worker; CHECK: sete %cl 70*9880d681SAndroid Build Coastguard Worker; CHECK: movl %ecx, %eax 71*9880d681SAndroid Build Coastguard Worker; CHECK: retq 72*9880d681SAndroid Build Coastguard Worker} 73*9880d681SAndroid Build Coastguard Worker 74*9880d681SAndroid Build Coastguard Workerdefine i32 @TestComp128NE(fp128 %d1, fp128 %d2) { 75*9880d681SAndroid Build Coastguard Workerentry: 76*9880d681SAndroid Build Coastguard Worker %cmp = fcmp une fp128 %d1, %d2 77*9880d681SAndroid Build Coastguard Worker %conv = zext i1 %cmp to i32 78*9880d681SAndroid Build Coastguard Worker ret i32 %conv 79*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: TestComp128NE: 80*9880d681SAndroid Build Coastguard Worker; CHECK: callq __netf2 81*9880d681SAndroid Build Coastguard Worker; CHECK: xorl %ecx, %ecx 82*9880d681SAndroid Build Coastguard Worker; CHECK: testl %eax, %eax 83*9880d681SAndroid Build Coastguard Worker; CHECK: setne %cl 84*9880d681SAndroid Build Coastguard Worker; CHECK: movl %ecx, %eax 85*9880d681SAndroid Build Coastguard Worker; CHECK: retq 86*9880d681SAndroid Build Coastguard Worker} 87*9880d681SAndroid Build Coastguard Worker 88*9880d681SAndroid Build Coastguard Workerdefine fp128 @TestMax(fp128 %x, fp128 %y) { 89*9880d681SAndroid Build Coastguard Workerentry: 90*9880d681SAndroid Build Coastguard Worker %cmp = fcmp ogt fp128 %x, %y 91*9880d681SAndroid Build Coastguard Worker %cond = select i1 %cmp, fp128 %x, fp128 %y 92*9880d681SAndroid Build Coastguard Worker ret fp128 %cond 93*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: TestMax: 94*9880d681SAndroid Build Coastguard Worker; CHECK: movaps %xmm0 95*9880d681SAndroid Build Coastguard Worker; CHECK: movaps %xmm1 96*9880d681SAndroid Build Coastguard Worker; CHECK: callq __gttf2 97*9880d681SAndroid Build Coastguard Worker; CHECK: movaps {{.*}}, %xmm0 98*9880d681SAndroid Build Coastguard Worker; CHECK: testl %eax, %eax 99*9880d681SAndroid Build Coastguard Worker; CHECK: movaps {{.*}}, %xmm0 100*9880d681SAndroid Build Coastguard Worker; CHECK: retq 101*9880d681SAndroid Build Coastguard Worker} 102