1 ; RUN: llc -march=r600 -mcpu=redwood < %s | FileCheck -check-prefix=EG %s -check-prefix=FUNC
2 ; RUN: llc -march=r600 -mcpu=verde -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
4 ; mul24 and mad24 are affected
7 ; EG: MULLO_INT {{\*? *}}T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
8 ; EG: MULLO_INT {{\*? *}}T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
10 ; SI: V_MUL_LO_I32 v{{[0-9]+, v[0-9]+, v[0-9]+}}
11 ; SI: V_MUL_LO_I32 v{{[0-9]+, v[0-9]+, v[0-9]+}}
13 define void @test2(<2 x i32> addrspace(1)* %out, <2 x i32> addrspace(1)* %in) {
14 %b_ptr = getelementptr <2 x i32> addrspace(1)* %in, i32 1
15 %a = load <2 x i32> addrspace(1) * %in
16 %b = load <2 x i32> addrspace(1) * %b_ptr
17 %result = mul <2 x i32> %a, %b
18 store <2 x i32> %result, <2 x i32> addrspace(1)* %out
23 ; EG: MULLO_INT {{\*? *}}T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
24 ; EG: MULLO_INT {{\*? *}}T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
25 ; EG: MULLO_INT {{\*? *}}T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
26 ; EG: MULLO_INT {{\*? *}}T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
28 ; SI: V_MUL_LO_I32 v{{[0-9]+, v[0-9]+, v[0-9]+}}
29 ; SI: V_MUL_LO_I32 v{{[0-9]+, v[0-9]+, v[0-9]+}}
30 ; SI: V_MUL_LO_I32 v{{[0-9]+, v[0-9]+, v[0-9]+}}
31 ; SI: V_MUL_LO_I32 v{{[0-9]+, v[0-9]+, v[0-9]+}}
33 define void @test4(<4 x i32> addrspace(1)* %out, <4 x i32> addrspace(1)* %in) {
34 %b_ptr = getelementptr <4 x i32> addrspace(1)* %in, i32 1
35 %a = load <4 x i32> addrspace(1) * %in
36 %b = load <4 x i32> addrspace(1) * %b_ptr
37 %result = mul <4 x i32> %a, %b
38 store <4 x i32> %result, <4 x i32> addrspace(1)* %out
42 ; FUNC-LABEL: @trunc_i64_mul_to_i32
46 ; SI: BUFFER_STORE_DWORD
47 define void @trunc_i64_mul_to_i32(i32 addrspace(1)* %out, i64 %a, i64 %b) {
49 %trunc = trunc i64 %mul to i32
50 store i32 %trunc, i32 addrspace(1)* %out, align 8
54 ; This 64-bit multiply should just use MUL_HI and MUL_LO, since the top
55 ; 32-bits of both arguments are sign bits.
56 ; FUNC-LABEL: @mul64_sext_c
59 ; SI-DAG: V_MUL_LO_I32
60 ; SI-DAG: V_MUL_HI_I32
61 define void @mul64_sext_c(i64 addrspace(1)* %out, i32 %in) {
63 %0 = sext i32 %in to i64
65 store i64 %1, i64 addrspace(1)* %out
69 ; A standard 64-bit multiply. The expansion should be around 6 instructions.
70 ; It would be difficult to match the expansion correctly without writing
71 ; a really complicated list of FileCheck expressions. I don't want
72 ; to confuse people who may 'break' this test with a correct optimization,
73 ; so this test just uses FUNC-LABEL to make sure the compiler does not
74 ; crash with a 'failed to select' error.
76 define void @mul64(i64 addrspace(1)* %out, i64 %a, i64 %b) {
79 store i64 %0, i64 addrspace(1)* %out