File: 2011-07-07-MatchIntrinsicExtract.ll

package info (click to toggle)
llvm-toolchain-9 1%3A9.0.1-16.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 882,388 kB
  • sloc: cpp: 4,167,636; ansic: 714,256; asm: 457,610; python: 155,927; objc: 65,094; sh: 42,856; lisp: 26,908; perl: 7,786; pascal: 7,722; makefile: 6,881; ml: 5,581; awk: 3,648; cs: 2,027; xml: 888; javascript: 381; ruby: 156
file content (91 lines) | stat: -rw-r--r-- 2,274 bytes parent folder | download | duplicates (11)
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
; RUN: opt < %s -newgvn -S | FileCheck %s
;

%0 = type { i64, i1 }

define i64 @test1(i64 %a, i64 %b) nounwind ssp {
entry:
  %uadd = tail call %0 @llvm.uadd.with.overflow.i64(i64 %a, i64 %b)
  %uadd.0 = extractvalue %0 %uadd, 0
  %add1 = add i64 %a, %b
  %add2 =  add i64 %add1, %uadd.0
  ret i64 %add2
}

; CHECK-LABEL: @test1(
; CHECK-NOT: add1
; CHECK: ret

define i64 @test2(i64 %a, i64 %b) nounwind ssp {
entry:
  %usub = tail call %0 @llvm.usub.with.overflow.i64(i64 %a, i64 %b)
  %usub.0 = extractvalue %0 %usub, 0
  %sub1 = sub i64 %a, %b
  %add2 =  add i64 %sub1, %usub.0
  ret i64 %add2
}

; CHECK-LABEL: @test2(
; CHECK-NOT: sub1
; CHECK: ret

define i64 @test3(i64 %a, i64 %b) nounwind ssp {
entry:
  %umul = tail call %0 @llvm.umul.with.overflow.i64(i64 %a, i64 %b)
  %umul.0 = extractvalue %0 %umul, 0
  %mul1 = mul i64 %a, %b
  %add2 =  add i64 %mul1, %umul.0
  ret i64 %add2
}

; CHECK-LABEL: @test3(
; CHECK-NOT: mul1
; CHECK: ret

define i64 @test4(i64 %a, i64 %b) nounwind ssp {
entry:
  %sadd = tail call %0 @llvm.sadd.with.overflow.i64(i64 %a, i64 %b)
  %sadd.0 = extractvalue %0 %sadd, 0
  %add1 = add i64 %a, %b
  %add2 =  add i64 %add1, %sadd.0
  ret i64 %add2
}

; CHECK-LABEL: @test4(
; CHECK-NOT: add1
; CHECK: ret

define i64 @test5(i64 %a, i64 %b) nounwind ssp {
entry:
  %ssub = tail call %0 @llvm.ssub.with.overflow.i64(i64 %a, i64 %b)
  %ssub.0 = extractvalue %0 %ssub, 0
  %sub1 = sub i64 %a, %b
  %add2 =  add i64 %sub1, %ssub.0
  ret i64 %add2
}

; CHECK-LABEL: @test5(
; CHECK-NOT: sub1
; CHECK: ret

define i64 @test6(i64 %a, i64 %b) nounwind ssp {
entry:
  %smul = tail call %0 @llvm.smul.with.overflow.i64(i64 %a, i64 %b)
  %smul.0 = extractvalue %0 %smul, 0
  %mul1 = mul i64 %a, %b
  %add2 =  add i64 %mul1, %smul.0
  ret i64 %add2
}

; CHECK-LABEL: @test6(
; CHECK-NOT: mul1
; CHECK: ret

declare void @exit(i32) noreturn
declare %0 @llvm.uadd.with.overflow.i64(i64, i64) nounwind readnone
declare %0 @llvm.usub.with.overflow.i64(i64, i64) nounwind readnone
declare %0 @llvm.umul.with.overflow.i64(i64, i64) nounwind readnone
declare %0 @llvm.sadd.with.overflow.i64(i64, i64) nounwind readnone
declare %0 @llvm.ssub.with.overflow.i64(i64, i64) nounwind readnone
declare %0 @llvm.smul.with.overflow.i64(i64, i64) nounwind readnone