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