File: beqc-bnec-register-constraint.ll

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (95 lines) | stat: -rw-r--r-- 3,238 bytes parent folder | download | duplicates (5)
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
92
93
94
95
; RUN: llc -march=mips -mcpu=mips32r6 -O1 -start-after=dwarfehprepare < %s | FileCheck %s
; RUN: llc -march=mips64 -mcpu=mips64r6 -O1 -start-after=dwarfehprepare < %s | FileCheck %s


; beqc/bnec have the constraint that $rs < $rt && $rs != 0 && $rt != 0
; Cases where $rs == 0 and $rt != 0 should be transformed into beqzc/bnezc.
; Cases where $rs > $rt can have the operands swapped as ==,!= are commutative.

; Cases where beq & bne where $rs == $rt have to inhibited from being turned
; into compact branches but arguably should not occur. This test covers the
; $rs == $rt case.

; Starting from dwarf exception handling preparation skips optimizations that
; may simplify out the crucical bnec $4, $4 instruction.

define internal void @_ZL14TestRemoveLastv(ptr %alist.sroa.0.4) {
; CHECK-LABEL: _ZL14TestRemoveLastv:
entry:
  %ascevgep = getelementptr i32, ptr %alist.sroa.0.4, i64 99
  br label %do.body121

for.cond117:
  %alsr.iv.next = add nsw i32 %alsr.iv, -1
  %ascevgep340 = getelementptr i32, ptr %alsr.iv339, i64 -1
  %acmp118 = icmp sgt i32 %alsr.iv.next, 0
  br i1 %acmp118, label %do.body121, label %if.then143

do.body121:
  %alsr.iv339 = phi ptr [ %ascevgep, %entry ], [ %ascevgep340, %for.cond117 ]
  %alsr.iv = phi i32 [ 100, %entry ], [ %alsr.iv.next, %for.cond117 ]
  %a9 = add i32 %alsr.iv, -1
  %alnot124 = icmp eq i32 %alsr.iv, %alsr.iv
  br i1 %alnot124, label %do.body134, label %if.then143, !prof !11

do.body134:
  %a10 = add i32 %alsr.iv, -1
  %a11 = load i32, ptr %alsr.iv339, align 4, !tbaa !5
; CHECK-NOT: bnec $[[R0:[0-9]+]], $[[R0]]
; CHECK-NOT: beqc $[[R1:[0-9]+]], $[[R1]]
  %alnot137 = icmp eq i32 %a9, %a11
  br i1 %alnot137, label %do.end146, label %if.then143, !prof !11

if.then143:
 ret void
 unreachable

do.end146:
  %alnot151 = icmp eq i32 %a9, %a10
  br i1 %alnot151, label %for.cond117, label %if.then143, !prof !11

}

define internal void @_ZL14TestRemoveLastv64(ptr %alist.sroa.0.4) {
; CHECK-LABEL: _ZL14TestRemoveLastv64:
entry:
  %ascevgep = getelementptr i64, ptr %alist.sroa.0.4, i64 99
  br label %do.body121

for.cond117:
  %alsr.iv.next = add nsw i64 %alsr.iv, -1
  %ascevgep340 = getelementptr i64, ptr %alsr.iv339, i64 -1
  %acmp118 = icmp sgt i64 %alsr.iv.next, 0
  br i1 %acmp118, label %do.body121, label %if.then143

do.body121:
  %alsr.iv339 = phi ptr [ %ascevgep, %entry ], [ %ascevgep340, %for.cond117 ]
  %alsr.iv = phi i64 [ 100, %entry ], [ %alsr.iv.next, %for.cond117 ]
  %a9 = add i64 %alsr.iv, -1
  %alnot124 = icmp eq i64 %alsr.iv, %alsr.iv
  br i1 %alnot124, label %do.body134, label %if.then143, !prof !11

do.body134:
  %a10 = add i64 %alsr.iv, -1
  %a11 = load i64, ptr %alsr.iv339, align 4, !tbaa !5
; CHECK-NOT: bnec $[[R0:[0-9]+]], $[[R0]]
; CHECK-NOT: beqc $[[R1:[0-9]+]], $[[R1]]
  %alnot137 = icmp eq i64 %a9, %a11
  br i1 %alnot137, label %do.end146, label %if.then143, !prof !11

if.then143:
 ret void
 unreachable

do.end146:
  %alnot151 = icmp eq i64 %a9, %a10
  br i1 %alnot151, label %for.cond117, label %if.then143, !prof !11

}
!3 = !{!"omnipotent char", !4, i64 0}
!4 = !{!"Simple C++ TBAA"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !3, i64 0}
!11 = !{!"branch_weights", i32 2000, i32 1}
!12 = !{!"branch_weights", i32 -388717296, i32 7818360}