Home | History | Annotate | Download | only in SystemZ
      1 ; Test the Test Data Class instruction logic operation conversion from
      2 ; signbit extraction.
      3 ;
      4 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
      5 ;
      6 
      7 ; Extract sign bit.
      8 define i32 @f1(float %x) {
      9 ; CHECK-LABEL: f1
     10 ; CHECK: tceb %f0, 1365
     11   %cast = bitcast float %x to i32
     12   %res = icmp slt i32 %cast, 0
     13   %xres = zext i1 %res to i32
     14   ret i32 %xres
     15 }
     16 
     17 ; Extract negated sign bit.
     18 define i32 @f2(float %x) {
     19 ; CHECK-LABEL: f2
     20 ; CHECK: tceb %f0, 2730
     21   %cast = bitcast float %x to i32
     22   %res = icmp sgt i32 %cast, -1
     23   %xres = zext i1 %res to i32
     24   ret i32 %xres
     25 }
     26 
     27 ; Extract sign bit.
     28 define i32 @f3(double %x) {
     29 ; CHECK-LABEL: f3
     30 ; CHECK: tcdb %f0, 1365
     31   %cast = bitcast double %x to i64
     32   %res = icmp slt i64 %cast, 0
     33   %xres = zext i1 %res to i32
     34   ret i32 %xres
     35 }
     36 
     37 ; Extract negated sign bit.
     38 define i32 @f4(double %x) {
     39 ; CHECK-LABEL: f4
     40 ; CHECK: tcdb %f0, 2730
     41   %cast = bitcast double %x to i64
     42   %res = icmp sgt i64 %cast, -1
     43   %xres = zext i1 %res to i32
     44   ret i32 %xres
     45 }
     46 
     47 ; Extract sign bit.
     48 define i32 @f5(fp128 %x) {
     49 ; CHECK-LABEL: f5
     50 ; CHECK: tcxb %f0, 1365
     51   %cast = bitcast fp128 %x to i128
     52   %res = icmp slt i128 %cast, 0
     53   %xres = zext i1 %res to i32
     54   ret i32 %xres
     55 }
     56 
     57 ; Extract negated sign bit.
     58 define i32 @f6(fp128 %x) {
     59 ; CHECK-LABEL: f6
     60 ; CHECK: tcxb %f0, 2730
     61   %cast = bitcast fp128 %x to i128
     62   %res = icmp sgt i128 %cast, -1
     63   %xres = zext i1 %res to i32
     64   ret i32 %xres
     65 }
     66 
     67 ; Wrong const.
     68 define i32 @f7(float %x) {
     69 ; CHECK-LABEL: f7
     70 ; CHECK-NOT: tceb
     71   %cast = bitcast float %x to i32
     72   %res = icmp slt i32 %cast, -1
     73   %xres = zext i1 %res to i32
     74   ret i32 %xres
     75 }
     76 
     77 ; Wrong pred.
     78 define i32 @f8(float %x) {
     79 ; CHECK-LABEL: f8
     80 ; CHECK-NOT: tceb
     81   %cast = bitcast float %x to i32
     82   %res = icmp eq i32 %cast, 0
     83   %xres = zext i1 %res to i32
     84   ret i32 %xres
     85 }
     86