1 ; RUN: llc < %s -march=r600 -mcpu=redwood | FileCheck %s --check-prefix=EG-CHECK
2 ; RUN: llc < %s -march=r600 -mcpu=cayman | FileCheck %s --check-prefix=EG-CHECK
3 ; RUN: llc < %s -march=r600 -mcpu=SI -verify-machineinstrs | FileCheck %s --check-prefix=SI-CHECK
5 ; EG-CHECK-LABEL: @u32_mad24
6 ; EG-CHECK: MULADD_UINT24 {{[* ]*}}T{{[0-9]\.[XYZW]}}, KC0[2].Z, KC0[2].W, KC0[3].X
7 ; SI-CHECK-LABEL: @u32_mad24
8 ; SI-CHECK: V_MAD_U32_U24
10 define void @u32_mad24(i32 addrspace(1)* %out, i32 %a, i32 %b, i32 %c) {
13 %a_24 = lshr i32 %0, 8
15 %b_24 = lshr i32 %1, 8
16 %2 = mul i32 %a_24, %b_24
18 store i32 %3, i32 addrspace(1)* %out
22 ; EG-CHECK-LABEL: @i16_mad24
23 ; EG-CHECK-DAG: VTX_READ_16 [[A:T[0-9]\.X]], T{{[0-9]}}.X, 40
24 ; EG-CHECK-DAG: VTX_READ_16 [[B:T[0-9]\.X]], T{{[0-9]}}.X, 44
25 ; EG-CHECK-DAG: VTX_READ_16 [[C:T[0-9]\.X]], T{{[0-9]}}.X, 48
26 ; The order of A and B does not matter.
27 ; EG-CHECK: MULADD_UINT24 {{[* ]*}}T{{[0-9]}}.[[MAD_CHAN:[XYZW]]], [[A]], [[B]], [[C]]
28 ; The result must be sign-extended
29 ; EG-CHECK: BFE_INT {{[* ]*}}T{{[0-9]\.[XYZW]}}, PV.[[MAD_CHAN]], 0.0, literal.x
31 ; SI-CHECK-LABEL: @i16_mad24
32 ; SI-CHECK: V_MAD_U32_U24 [[MAD:v[0-9]]], {{[sv][0-9], [sv][0-9]}}
33 ; SI-CHECK: V_BFE_I32 v{{[0-9]}}, [[MAD]], 0, 16
35 define void @i16_mad24(i32 addrspace(1)* %out, i16 %a, i16 %b, i16 %c) {
39 %2 = sext i16 %1 to i32
40 store i32 %2, i32 addrspace(1)* %out
44 ; EG-CHECK-LABEL: @i8_mad24
45 ; EG-CHECK-DAG: VTX_READ_8 [[A:T[0-9]\.X]], T{{[0-9]}}.X, 40
46 ; EG-CHECK-DAG: VTX_READ_8 [[B:T[0-9]\.X]], T{{[0-9]}}.X, 44
47 ; EG-CHECK-DAG: VTX_READ_8 [[C:T[0-9]\.X]], T{{[0-9]}}.X, 48
48 ; The order of A and B does not matter.
49 ; EG-CHECK: MULADD_UINT24 {{[* ]*}}T{{[0-9]}}.[[MAD_CHAN:[XYZW]]], [[A]], [[B]], [[C]]
50 ; The result must be sign-extended
51 ; EG-CHECK: BFE_INT {{[* ]*}}T{{[0-9]\.[XYZW]}}, PV.[[MAD_CHAN]], 0.0, literal.x
53 ; SI-CHECK-LABEL: @i8_mad24
54 ; SI-CHECK: V_MAD_U32_U24 [[MUL:v[0-9]]], {{[sv][0-9], [sv][0-9]}}
55 ; SI-CHECK: V_BFE_I32 v{{[0-9]}}, [[MUL]], 0, 8
57 define void @i8_mad24(i32 addrspace(1)* %out, i8 %a, i8 %b, i8 %c) {
61 %2 = sext i8 %1 to i32
62 store i32 %2, i32 addrspace(1)* %out