Home | History | Annotate | Download | only in R600
      1 ; RUN: llc < %s -march=r600 -mcpu=redwood | FileCheck --check-prefix=R600-CHECK %s
      2 ; RUN: llc < %s -march=r600 -mcpu=SI -verify-machineinstrs | FileCheck --check-prefix=SI-CHECK %s
      3 
      4 ; BFI_INT Definition pattern from ISA docs
      5 ; (y & x) | (z & ~x)
      6 ;
      7 ; R600-CHECK: @bfi_def
      8 ; R600-CHECK: BFI_INT
      9 ; SI-CHECK:   @bfi_def
     10 ; SI-CHECK:   V_BFI_B32
     11 define void @bfi_def(i32 addrspace(1)* %out, i32 %x, i32 %y, i32 %z) {
     12 entry:
     13   %0 = xor i32 %x, -1
     14   %1 = and i32 %z, %0
     15   %2 = and i32 %y, %x
     16   %3 = or i32 %1, %2
     17   store i32 %3, i32 addrspace(1)* %out
     18   ret void
     19 }
     20 
     21 ; SHA-256 Ch function
     22 ; z ^ (x & (y ^ z))
     23 ; R600-CHECK: @bfi_sha256_ch
     24 ; R600-CHECK: BFI_INT
     25 ; SI-CHECK:   @bfi_sha256_ch
     26 ; SI-CHECK:   V_BFI_B32
     27 define void @bfi_sha256_ch(i32 addrspace(1)* %out, i32 %x, i32 %y, i32 %z) {
     28 entry:
     29   %0 = xor i32 %y, %z
     30   %1 = and i32 %x, %0
     31   %2 = xor i32 %z, %1
     32   store i32 %2, i32 addrspace(1)* %out
     33   ret void
     34 }
     35 
     36 ; SHA-256 Ma function
     37 ; ((x & z) | (y & (x | z)))
     38 ; R600-CHECK: @bfi_sha256_ma
     39 ; R600-CHECK: XOR_INT * [[DST:T[0-9]+\.[XYZW]]], KC0[2].Z, KC0[2].W
     40 ; R600-CHECK: BFI_INT * {{T[0-9]+\.[XYZW]}}, {{[[DST]]|PV\.[XYZW]}}, KC0[3].X, KC0[2].W
     41 ; SI-CHECK: V_XOR_B32_e64 [[DST:v[0-9]+]], {{[sv][0-9]+, v[0-9]+}}
     42 ; SI-CHECK: V_BFI_B32 {{v[0-9]+}}, [[DST]], {{[sv][0-9]+, [sv][0-9]+}}
     43 
     44 define void @bfi_sha256_ma(i32 addrspace(1)* %out, i32 %x, i32 %y, i32 %z) {
     45 entry:
     46   %0 = and i32 %x, %z
     47   %1 = or i32 %x, %z
     48   %2 = and i32 %y, %1
     49   %3 = or i32 %0, %2
     50   store i32 %3, i32 addrspace(1)* %out
     51   ret void
     52 }
     53