• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -march=r600 -mcpu=SI -verify-machineinstrs< %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
2; RUN: llc -march=r600 -mcpu=cypress -verify-machineinstrs< %s
3
4declare { i32, i1 } @llvm.sadd.with.overflow.i32(i32, i32) nounwind readnone
5declare { i64, i1 } @llvm.sadd.with.overflow.i64(i64, i64) nounwind readnone
6
7; FUNC-LABEL: @saddo_i64_zext
8define void @saddo_i64_zext(i64 addrspace(1)* %out, i64 %a, i64 %b) nounwind {
9  %sadd = call { i64, i1 } @llvm.sadd.with.overflow.i64(i64 %a, i64 %b) nounwind
10  %val = extractvalue { i64, i1 } %sadd, 0
11  %carry = extractvalue { i64, i1 } %sadd, 1
12  %ext = zext i1 %carry to i64
13  %add2 = add i64 %val, %ext
14  store i64 %add2, i64 addrspace(1)* %out, align 8
15  ret void
16}
17
18; FUNC-LABEL: @s_saddo_i32
19define void @s_saddo_i32(i32 addrspace(1)* %out, i1 addrspace(1)* %carryout, i32 %a, i32 %b) nounwind {
20  %sadd = call { i32, i1 } @llvm.sadd.with.overflow.i32(i32 %a, i32 %b) nounwind
21  %val = extractvalue { i32, i1 } %sadd, 0
22  %carry = extractvalue { i32, i1 } %sadd, 1
23  store i32 %val, i32 addrspace(1)* %out, align 4
24  store i1 %carry, i1 addrspace(1)* %carryout
25  ret void
26}
27
28; FUNC-LABEL: @v_saddo_i32
29define void @v_saddo_i32(i32 addrspace(1)* %out, i1 addrspace(1)* %carryout, i32 addrspace(1)* %aptr, i32 addrspace(1)* %bptr) nounwind {
30  %a = load i32 addrspace(1)* %aptr, align 4
31  %b = load i32 addrspace(1)* %bptr, align 4
32  %sadd = call { i32, i1 } @llvm.sadd.with.overflow.i32(i32 %a, i32 %b) nounwind
33  %val = extractvalue { i32, i1 } %sadd, 0
34  %carry = extractvalue { i32, i1 } %sadd, 1
35  store i32 %val, i32 addrspace(1)* %out, align 4
36  store i1 %carry, i1 addrspace(1)* %carryout
37  ret void
38}
39
40; FUNC-LABEL: @s_saddo_i64
41define void @s_saddo_i64(i64 addrspace(1)* %out, i1 addrspace(1)* %carryout, i64 %a, i64 %b) nounwind {
42  %sadd = call { i64, i1 } @llvm.sadd.with.overflow.i64(i64 %a, i64 %b) nounwind
43  %val = extractvalue { i64, i1 } %sadd, 0
44  %carry = extractvalue { i64, i1 } %sadd, 1
45  store i64 %val, i64 addrspace(1)* %out, align 8
46  store i1 %carry, i1 addrspace(1)* %carryout
47  ret void
48}
49
50; FUNC-LABEL: @v_saddo_i64
51; SI: V_ADD_I32
52; SI: V_ADDC_U32
53define void @v_saddo_i64(i64 addrspace(1)* %out, i1 addrspace(1)* %carryout, i64 addrspace(1)* %aptr, i64 addrspace(1)* %bptr) nounwind {
54  %a = load i64 addrspace(1)* %aptr, align 4
55  %b = load i64 addrspace(1)* %bptr, align 4
56  %sadd = call { i64, i1 } @llvm.sadd.with.overflow.i64(i64 %a, i64 %b) nounwind
57  %val = extractvalue { i64, i1 } %sadd, 0
58  %carry = extractvalue { i64, i1 } %sadd, 1
59  store i64 %val, i64 addrspace(1)* %out, align 8
60  store i1 %carry, i1 addrspace(1)* %carryout
61  ret void
62}
63