Home | History | Annotate | Download | only in R600
      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
      3 
      4 ; mul24 and mad24 are affected
      5 
      6 ; FUNC-LABEL: @test2
      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]}}
      9 
     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]+}}
     12 
     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
     19   ret void
     20 }
     21 
     22 ; FUNC-LABEL: @test4
     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]}}
     27 
     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]+}}
     32 
     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
     39   ret void
     40 }
     41 
     42 ; FUNC-LABEL: @trunc_i64_mul_to_i32
     43 ; SI: S_LOAD_DWORD
     44 ; SI: S_LOAD_DWORD
     45 ; SI: V_MUL_LO_I32
     46 ; SI: BUFFER_STORE_DWORD
     47 define void @trunc_i64_mul_to_i32(i32 addrspace(1)* %out, i64 %a, i64 %b) {
     48   %mul = mul i64 %b, %a
     49   %trunc = trunc i64 %mul to i32
     50   store i32 %trunc, i32 addrspace(1)* %out, align 8
     51   ret void
     52 }
     53 
     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
     57 ; EG-DAG: MULLO_INT
     58 ; EG-DAG: MULHI_INT
     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) {
     62 entry:
     63   %0 = sext i32 %in to i64
     64   %1 = mul i64 %0, 80
     65   store i64 %1, i64 addrspace(1)* %out
     66   ret void
     67 }
     68 
     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.
     75 ; FUNC-LABEL: @mul64
     76 define void @mul64(i64 addrspace(1)* %out, i64 %a, i64 %b) {
     77 entry:
     78   %0 = mul i64 %a, %b
     79   store i64 %0, i64 addrspace(1)* %out
     80   ret void
     81 }
     82