Matt Arsenault | 825fb0b | 2014-06-13 04:00:30 +0000 | [diff] [blame] | 1 | ; RUN: llc -march=r600 -mcpu=redwood < %s | FileCheck --check-prefix=R600 -check-prefix=FUNC %s |
| 2 | ; RUN: llc -march=r600 -mcpu=SI -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s |
| 3 | |
Tom Stellard | 79243d9 | 2014-10-01 17:15:17 +0000 | [diff] [blame^] | 4 | ; FUNC-LABEL: {{^}}rotl_i32: |
Matt Arsenault | 825fb0b | 2014-06-13 04:00:30 +0000 | [diff] [blame] | 5 | ; R600: SUB_INT {{\** T[0-9]+\.[XYZW]}}, literal.x |
| 6 | ; R600-NEXT: 32 |
| 7 | ; R600: BIT_ALIGN_INT {{T[0-9]+\.[XYZW]}}, KC0[2].Z, KC0[2].Z, PV.{{[XYZW]}} |
| 8 | |
| 9 | ; SI: S_SUB_I32 [[SDST:s[0-9]+]], 32, {{[s][0-9]+}} |
| 10 | ; SI: V_MOV_B32_e32 [[VDST:v[0-9]+]], [[SDST]] |
Matt Arsenault | cb0ac3d | 2014-09-26 17:54:59 +0000 | [diff] [blame] | 11 | ; SI: V_ALIGNBIT_B32 {{v[0-9]+, [s][0-9]+, s[0-9]+}}, [[VDST]] |
Matt Arsenault | 825fb0b | 2014-06-13 04:00:30 +0000 | [diff] [blame] | 12 | define void @rotl_i32(i32 addrspace(1)* %in, i32 %x, i32 %y) { |
| 13 | entry: |
| 14 | %0 = shl i32 %x, %y |
| 15 | %1 = sub i32 32, %y |
| 16 | %2 = lshr i32 %x, %1 |
| 17 | %3 = or i32 %0, %2 |
| 18 | store i32 %3, i32 addrspace(1)* %in |
| 19 | ret void |
| 20 | } |
| 21 | |
Tom Stellard | 79243d9 | 2014-10-01 17:15:17 +0000 | [diff] [blame^] | 22 | ; FUNC-LABEL: {{^}}rotl_v2i32: |
Matt Arsenault | 4c24d73 | 2014-09-02 21:45:50 +0000 | [diff] [blame] | 23 | ; SI-DAG: S_SUB_I32 |
| 24 | ; SI-DAG: S_SUB_I32 |
| 25 | ; SI-DAG: V_ALIGNBIT_B32 |
| 26 | ; SI-DAG: V_ALIGNBIT_B32 |
| 27 | ; SI: S_ENDPGM |
Matt Arsenault | 825fb0b | 2014-06-13 04:00:30 +0000 | [diff] [blame] | 28 | define void @rotl_v2i32(<2 x i32> addrspace(1)* %in, <2 x i32> %x, <2 x i32> %y) { |
| 29 | entry: |
| 30 | %0 = shl <2 x i32> %x, %y |
| 31 | %1 = sub <2 x i32> <i32 32, i32 32>, %y |
| 32 | %2 = lshr <2 x i32> %x, %1 |
| 33 | %3 = or <2 x i32> %0, %2 |
| 34 | store <2 x i32> %3, <2 x i32> addrspace(1)* %in |
| 35 | ret void |
| 36 | } |
| 37 | |
Tom Stellard | 79243d9 | 2014-10-01 17:15:17 +0000 | [diff] [blame^] | 38 | ; FUNC-LABEL: {{^}}rotl_v4i32: |
Matt Arsenault | 4c24d73 | 2014-09-02 21:45:50 +0000 | [diff] [blame] | 39 | ; SI-DAG: S_SUB_I32 |
| 40 | ; SI-DAG: V_ALIGNBIT_B32 |
| 41 | ; SI-DAG: S_SUB_I32 |
| 42 | ; SI-DAG: V_ALIGNBIT_B32 |
| 43 | ; SI-DAG: S_SUB_I32 |
| 44 | ; SI-DAG: V_ALIGNBIT_B32 |
| 45 | ; SI-DAG: S_SUB_I32 |
| 46 | ; SI-DAG: V_ALIGNBIT_B32 |
| 47 | ; SI: S_ENDPGM |
Matt Arsenault | 825fb0b | 2014-06-13 04:00:30 +0000 | [diff] [blame] | 48 | define void @rotl_v4i32(<4 x i32> addrspace(1)* %in, <4 x i32> %x, <4 x i32> %y) { |
| 49 | entry: |
| 50 | %0 = shl <4 x i32> %x, %y |
| 51 | %1 = sub <4 x i32> <i32 32, i32 32, i32 32, i32 32>, %y |
| 52 | %2 = lshr <4 x i32> %x, %1 |
| 53 | %3 = or <4 x i32> %0, %2 |
| 54 | store <4 x i32> %3, <4 x i32> addrspace(1)* %in |
| 55 | ret void |
| 56 | } |