Home | History | Annotate | Download | only in Hexagon
      1 ; RUN: llc -march=hexagon < %s | FileCheck %s
      2 ;
      3 ; Bug 6714. Use sign-extend to promote the arguments for compare
      4 ; equal/not-equal for 8- and 16-bit types with negative constants.
      5 
      6 ; CHECK: cmp.eq{{.*}}#-16
      7 define i32 @foo1(i16 signext %q) nounwind readnone {
      8 entry:
      9   %not.cmp = icmp ne i16 %q, -16
     10   %res.0 = zext i1 %not.cmp to i32
     11   ret i32 %res.0
     12 }
     13 
     14 ; CHECK: cmp.eq{{.*}}#-14
     15 define i32 @foo2(i16 signext %q) nounwind readnone {
     16 entry:
     17   %cmp = icmp eq i16 %q, -14
     18   %res.0 = select i1 %cmp, i32 2, i32 0
     19   ret i32 %res.0
     20 }
     21 
     22 ; CHECK: cmp.eq{{.*}}#-8
     23 define i32 @foo3(i8 signext %r) nounwind readnone {
     24 entry:
     25   %cmp = icmp eq i8 %r, -8
     26   %res.0 = select i1 %cmp, i32 0, i32 3
     27   ret i32 %res.0
     28 }
     29 
     30 ; CHECK: cmp.eq{{.*}}#-6
     31 define i32 @foo4(i8 signext %r) nounwind readnone {
     32 entry:
     33   %cmp = icmp eq i8 %r, -6
     34   %res.0 = select i1 %cmp, i32 4, i32 0
     35   ret i32 %res.0
     36 }
     37 
     38 ; CHECK: cmp.eq{{.*}}#-20
     39 define i32 @foo5(i32 %s) nounwind readnone {
     40 entry:
     41   %cmp = icmp eq i32 %s, -20
     42   %res.0 = select i1 %cmp, i32 0, i32 5
     43   ret i32 %res.0
     44 }
     45 
     46 ; CHECK: cmp.eq{{.*}}#-18
     47 define i32 @foo6(i32 %s) nounwind readnone {
     48 entry:
     49   %cmp = icmp eq i32 %s, -18
     50   %res.0 = select i1 %cmp, i32 6, i32 0
     51   ret i32 %res.0
     52 }
     53 
     54 ; CHECK: cmp.eq{{.*}}#10
     55 define i32 @foo7(i16 signext %q) nounwind readnone {
     56 entry:
     57   %cmp = icmp eq i16 %q, 10
     58   %res.0 = select i1 %cmp, i32 7, i32 0
     59   ret i32 %res.0
     60 }
     61 
     62 @g = external global i16
     63 
     64 ; CHECK: cmp.eq{{.*}}#-12
     65 define i32 @foo8() nounwind readonly {
     66 entry:
     67   %0 = load i16, i16* @g, align 2
     68   %cmp = icmp eq i16 %0, -12
     69   %res.0 = select i1 %cmp, i32 0, i32 8
     70   ret i32 %res.0
     71 }
     72 
     73