Home | History | Annotate | Download | only in PowerPC
      1 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -O2 \
      2 ; RUN:   -ppc-gpr-icmps=all -ppc-asm-full-reg-names -mcpu=pwr8 < %s | FileCheck %s \
      3 ; RUN:  --implicit-check-not cmpw --implicit-check-not cmpd --implicit-check-not cmpl
      4 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -O2 \
      5 ; RUN:   -ppc-gpr-icmps=all -ppc-asm-full-reg-names -mcpu=pwr8 < %s | FileCheck %s \
      6 ; RUN:  --implicit-check-not cmpw --implicit-check-not cmpd --implicit-check-not cmpl
      7 
      8 @glob = common local_unnamed_addr global i16 0, align 2
      9 
     10 ; Function Attrs: norecurse nounwind readnone
     11 define signext i32 @test_igtus(i16 zeroext %a, i16 zeroext %b) {
     12 ; CHECK-LABEL: test_igtus:
     13 ; CHECK:    sub [[REG:r[0-9]+]], r4, r3
     14 ; CHECK-NEXT:    rldicl r3, [[REG]], 1, 63
     15 ; CHECK-NEXT:    blr
     16 entry:
     17   %cmp = icmp ugt i16 %a, %b
     18   %conv2 = zext i1 %cmp to i32
     19   ret i32 %conv2
     20 }
     21 
     22 ; Function Attrs: norecurse nounwind readnone
     23 define signext i32 @test_igtus_sext(i16 zeroext %a, i16 zeroext %b) {
     24 ; CHECK-LABEL: test_igtus_sext:
     25 ; CHECK:    sub [[REG:r[0-9]+]], r4, r3
     26 ; CHECK-NEXT:    sradi r3, [[REG]], 63
     27 ; CHECK-NEXT:    blr
     28 entry:
     29   %cmp = icmp ugt i16 %a, %b
     30   %sub = sext i1 %cmp to i32
     31   ret i32 %sub
     32 }
     33 
     34 ; Function Attrs: norecurse nounwind readnone
     35 define signext i32 @test_igtus_z(i16 zeroext %a) {
     36 ; CHECK-LABEL: test_igtus_z:
     37 ; CHECK:    cntlzw r3, r3
     38 ; CHECK-NEXT:    srwi r3, r3, 5
     39 ; CHECK-NEXT:    xori r3, r3, 1
     40 ; CHECK-NEXT:    blr
     41 entry:
     42   %cmp = icmp ne i16 %a, 0
     43   %conv1 = zext i1 %cmp to i32
     44   ret i32 %conv1
     45 }
     46 
     47 ; Function Attrs: norecurse nounwind readnone
     48 define signext i32 @test_igtus_sext_z(i16 zeroext %a) {
     49 ; CHECK-LABEL: test_igtus_sext_z:
     50 ; CHECK:    cntlzw r3, r3
     51 ; CHECK-NEXT:    srwi r3, r3, 5
     52 ; CHECK-NEXT:    xori r3, r3, 1
     53 ; CHECK-NEXT:    neg r3, r3
     54 ; CHECK-NEXT:    blr
     55 entry:
     56   %cmp = icmp ne i16 %a, 0
     57   %sub = sext i1 %cmp to i32
     58   ret i32 %sub
     59 }
     60 
     61 ; Function Attrs: norecurse nounwind
     62 define void @test_igtus_store(i16 zeroext %a, i16 zeroext %b) {
     63 ; CHECK-LABEL: test_igtus_store:
     64 ; CHECK:         sub [[REG:r[0-9]+]], r4, r3
     65 ; CHECK:         rldicl {{r[0-9]+}}, [[REG]], 1, 63
     66 ; CHECK:         blr
     67 entry:
     68   %cmp = icmp ugt i16 %a, %b
     69   %conv3 = zext i1 %cmp to i16
     70   store i16 %conv3, i16* @glob, align 2
     71   ret void
     72 }
     73 
     74 ; Function Attrs: norecurse nounwind
     75 define void @test_igtus_sext_store(i16 zeroext %a, i16 zeroext %b) {
     76 ; CHECK-LABEL: test_igtus_sext_store:
     77 ; CHECK:         sub [[REG:r[0-9]+]], r4, r3
     78 ; CHECK:         sradi {{r[0-9]+}}, [[REG]], 63
     79 ; CHECK:         blr
     80 entry:
     81   %cmp = icmp ugt i16 %a, %b
     82   %conv3 = sext i1 %cmp to i16
     83   store i16 %conv3, i16* @glob, align 2
     84   ret void
     85 }
     86 
     87 ; Function Attrs: norecurse nounwind
     88 define void @test_igtus_z_store(i16 zeroext %a) {
     89 ; CHECK-LABEL: test_igtus_z_store:
     90 ; CHECK:    cntlzw r3, r3
     91 ; CHECK:    srwi r3, r3, 5
     92 ; CHECK:    xori r3, r3, 1
     93 ; CHECK:    sth r3, 0(r4)
     94 ; CHECK-NEXT:    blr
     95 entry:
     96   %cmp = icmp ne i16 %a, 0
     97   %conv2 = zext i1 %cmp to i16
     98   store i16 %conv2, i16* @glob, align 2
     99   ret void
    100 }
    101 
    102 ; Function Attrs: norecurse nounwind
    103 define void @test_igtus_sext_z_store(i16 zeroext %a) {
    104 ; CHECK-LABEL: test_igtus_sext_z_store:
    105 ; CHECK:    cntlzw r3, r3
    106 ; CHECK:    srwi r3, r3, 5
    107 ; CHECK:    xori r3, r3, 1
    108 ; CHECK:    neg r3, r3
    109 ; CHECK:    sth r3, 0(r4)
    110 ; CHECK-NEXT:    blr
    111 entry:
    112   %cmp = icmp ne i16 %a, 0
    113   %conv2 = sext i1 %cmp to i16
    114   store i16 %conv2, i16* @glob, align 2
    115   ret void
    116 }
    117 
    118