aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/CodeGen/PowerPC/uaddo-32.ll
blob: 5dd5a2672b166ccf6ea560b164d9889487050020 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
; RUN: llc < %s -mtriple=powerpc-unknown-linux-gnu | FileCheck %s --check-prefix=LINUXASM
; RUN: llc < %s -mtriple=powerpc-ibm-aix-xcoff | FileCheck %s --check-prefix=AIXASM

define noundef i32 @add(i32 noundef %a, i32 noundef %b, ptr nocapture noundef writeonly %ovf) {
; LINUXASM-LABEL: add:
; LINUXASM:       # %bb.0: # %entry
; LINUXASM-NEXT:    li 6, 0
; LINUXASM-NEXT:    addc 3, 3, 4
; LINUXASM-NEXT:    addze 4, 6
; LINUXASM-NEXT:    stw 4, 0(5)
; LINUXASM-NEXT:    blr

; AIXASM-LABEL: .add:
; AIXASM:       # %bb.0:                                # %entry
; AIXASM-NEXT:    addc 3, 3, 4
; AIXASM-NEXT:    li 4, 0
; AIXASM-NEXT:    addze 4, 4
; AIXASM-NEXT:    stw 4, 0(5)
; AIXASM-NEXT:    blr

entry:
  %0 = tail call { i32, i1 } @llvm.uadd.with.overflow.i32(i32 %a, i32 %b)
  %1 = extractvalue { i32, i1 } %0, 1
  %2 = extractvalue { i32, i1 } %0, 0
  %3 = zext i1 %1 to i32
  store i32 %3, ptr %ovf, align 8
  ret i32 %2
}

declare { i32, i1 } @llvm.uadd.with.overflow.i32(i32, i32)

define noundef zeroext i1 @add_overflow(i32 noundef %a, i32 noundef %b, ptr nocapture noundef writeonly %ovf) {
; LINUXASM-LABEL: add_overflow:
; LINUXASM:       # %bb.0: # %entry
; LINUXASM-NEXT:    li 6, 0
; LINUXASM-NEXT:    addc 4, 3, 4
; LINUXASM-NEXT:    addze 3, 6
; LINUXASM-NEXT:    stw 4, 0(5)
; LINUXASM-NEXT:    blr

; AIXASM-LABEL: .add_overflow:
; AIXASM:       # %bb.0:                                # %entry
; AIXASM-NEXT:    addc 4, 3, 4
; AIXASM-NEXT:    li 3, 0
; AIXASM-NEXT:    addze 3, 3
; AIXASM-NEXT:    stw 4, 0(5)
; AIXASM-NEXT:    blr

entry:
  %0 = tail call { i32, i1 } @llvm.uadd.with.overflow.i32(i32 %a, i32 %b)
  %1 = extractvalue { i32, i1 } %0, 1
  %2 = extractvalue { i32, i1 } %0, 0
  store i32 %2, ptr %ovf, align 8
  ret i1 %1
}