Home | History | Annotate | Download | only in PowerPC
      1 ; RUN: llc -verify-machineinstrs -mcpu=ppc64 < %s | FileCheck %s
      2 ; RUN: llc -verify-machineinstrs -mtriple=powerpc-unknown-linux-gnu -mcpu=ppc < %s | FileCheck -check-prefix=CHECK-32 %s
      3 target datalayout = "E-m:e-i64:64-n32:64"
      4 target triple = "powerpc64-unknown-linux-gnu"
      5 
      6 ; Function Attrs: nounwind readnone
      7 define signext i32 @foo4(i32 signext %a) #0 {
      8 entry:
      9   %div = sdiv i32 %a, 8
     10   ret i32 %div
     11 
     12 ; CHECK-LABEL: @foo4
     13 ; CHECK: srawi [[REG1:[0-9]+]], 3, 3
     14 ; CHECK: addze [[REG2:[0-9]+]], [[REG1]]
     15 ; CHECK: extsw 3, [[REG2]]
     16 ; CHECK: blr
     17 }
     18 
     19 ; Function Attrs: nounwind readnone
     20 define i64 @foo8(i64 %a) #0 {
     21 entry:
     22   %div = sdiv i64 %a, 8
     23   ret i64 %div
     24 
     25 ; CHECK-LABEL: @foo8
     26 ; CHECK: sradi [[REG1:[0-9]+]], 3, 3
     27 ; CHECK: addze 3, [[REG1]]
     28 ; CHECK: blr
     29 
     30 ; CHECK-32-LABEL: @foo8
     31 ; CHECK-32-NOT: sradi
     32 ; CHECK-32: blr
     33 }
     34 
     35 ; Function Attrs: nounwind readnone
     36 define signext i32 @foo4n(i32 signext %a) #0 {
     37 entry:
     38   %div = sdiv i32 %a, -8
     39   ret i32 %div
     40 
     41 ; CHECK-LABEL: @foo4n
     42 ; CHECK: srawi [[REG1:[0-9]+]], 3, 3
     43 ; CHECK: addze [[REG2:[0-9]+]], [[REG1]]
     44 ; CHECK: neg [[REG3:[0-9]+]], [[REG2]]
     45 ; CHECK: extsw 3, [[REG3]]
     46 ; CHECK: blr
     47 }
     48 
     49 ; Function Attrs: nounwind readnone
     50 define i64 @foo8n(i64 %a) #0 {
     51 entry:
     52   %div = sdiv i64 %a, -8
     53   ret i64 %div
     54 
     55 ; CHECK-LABEL: @foo8n
     56 ; CHECK: sradi [[REG1:[0-9]+]], 3, 3
     57 ; CHECK: addze [[REG2:[0-9]+]], [[REG1]]
     58 ; CHECK: neg 3, [[REG2]]
     59 ; CHECK: blr
     60 
     61 ; CHECK-32-LABEL: @foo8n
     62 ; CHECK-32-NOT: sradi
     63 ; CHECK-32: blr
     64 }
     65 
     66 attributes #0 = { nounwind readnone }
     67 
     68