File: scmp.ll

package info (click to toggle)
llvm-toolchain-21 1%3A21.1.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,245,064 kB
  • sloc: cpp: 7,619,731; ansic: 1,434,018; asm: 1,058,748; python: 252,740; f90: 94,671; objc: 70,685; lisp: 42,813; pascal: 18,401; sh: 8,601; ml: 5,111; perl: 4,720; makefile: 3,676; awk: 3,523; javascript: 2,409; xml: 892; fortran: 770
file content (156 lines) | stat: -rw-r--r-- 4,191 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
; RUN: llc < %s -mtriple=riscv32 -global-isel | FileCheck %s --check-prefix=RV32I
; RUN: llc < %s -mtriple=riscv64 -global-isel | FileCheck %s --check-prefix=RV64I

define i8 @scmp.8.8(i8 signext %x, i8 signext %y) nounwind {
; RV32I-LABEL: scmp.8.8:
; RV32I:       # %bb.0:
; RV32I-NEXT:    slt a2, a1, a0
; RV32I-NEXT:    slt a0, a0, a1
; RV32I-NEXT:    sub a0, a2, a0
; RV32I-NEXT:    ret
;
; RV64I-LABEL: scmp.8.8:
; RV64I:       # %bb.0:
; RV64I-NEXT:    slt a2, a1, a0
; RV64I-NEXT:    slt a0, a0, a1
; RV64I-NEXT:    sub a0, a2, a0
; RV64I-NEXT:    ret
  %1 = call i8 @llvm.scmp(i8 %x, i8 %y)
  ret i8 %1
}

define i8 @scmp.8.16(i16 signext %x, i16 signext %y) nounwind {
; RV32I-LABEL: scmp.8.16:
; RV32I:       # %bb.0:
; RV32I-NEXT:    slt a2, a1, a0
; RV32I-NEXT:    slt a0, a0, a1
; RV32I-NEXT:    sub a0, a2, a0
; RV32I-NEXT:    ret
;
; RV64I-LABEL: scmp.8.16:
; RV64I:       # %bb.0:
; RV64I-NEXT:    slt a2, a1, a0
; RV64I-NEXT:    slt a0, a0, a1
; RV64I-NEXT:    sub a0, a2, a0
; RV64I-NEXT:    ret
  %1 = call i8 @llvm.scmp(i16 %x, i16 %y)
  ret i8 %1
}

define i8 @scmp.8.32(i32 %x, i32 %y) nounwind {
; RV32I-LABEL: scmp.8.32:
; RV32I:       # %bb.0:
; RV32I-NEXT:    slt a2, a1, a0
; RV32I-NEXT:    slt a0, a0, a1
; RV32I-NEXT:    sub a0, a2, a0
; RV32I-NEXT:    ret
;
; RV64I-LABEL: scmp.8.32:
; RV64I:       # %bb.0:
; RV64I-NEXT:    sext.w a0, a0
; RV64I-NEXT:    sext.w a1, a1
; RV64I-NEXT:    slt a2, a1, a0
; RV64I-NEXT:    slt a0, a0, a1
; RV64I-NEXT:    sub a0, a2, a0
; RV64I-NEXT:    ret
  %1 = call i8 @llvm.scmp(i32 %x, i32 %y)
  ret i8 %1
}

define i8 @scmp.8.64(i64 %x, i64 %y) nounwind {
; RV32I-LABEL: scmp.8.64:
; RV32I:       # %bb.0:
; RV32I-NEXT:    beq a1, a3, .LBB3_2
; RV32I-NEXT:  # %bb.1:
; RV32I-NEXT:    slt a4, a3, a1
; RV32I-NEXT:    slt a0, a1, a3
; RV32I-NEXT:    sub a0, a4, a0
; RV32I-NEXT:    ret
; RV32I-NEXT:  .LBB3_2:
; RV32I-NEXT:    sltu a4, a2, a0
; RV32I-NEXT:    sltu a0, a0, a2
; RV32I-NEXT:    sub a0, a4, a0
; RV32I-NEXT:    ret
;
; RV64I-LABEL: scmp.8.64:
; RV64I:       # %bb.0:
; RV64I-NEXT:    slt a2, a1, a0
; RV64I-NEXT:    slt a0, a0, a1
; RV64I-NEXT:    sub a0, a2, a0
; RV64I-NEXT:    ret
  %1 = call i8 @llvm.scmp(i64 %x, i64 %y)
  ret i8 %1
}

define i32 @scmp.32.32(i32 %x, i32 %y) nounwind {
; RV32I-LABEL: scmp.32.32:
; RV32I:       # %bb.0:
; RV32I-NEXT:    slt a2, a1, a0
; RV32I-NEXT:    slt a0, a0, a1
; RV32I-NEXT:    sub a0, a2, a0
; RV32I-NEXT:    ret
;
; RV64I-LABEL: scmp.32.32:
; RV64I:       # %bb.0:
; RV64I-NEXT:    sext.w a0, a0
; RV64I-NEXT:    sext.w a1, a1
; RV64I-NEXT:    slt a2, a1, a0
; RV64I-NEXT:    slt a0, a0, a1
; RV64I-NEXT:    subw a0, a2, a0
; RV64I-NEXT:    ret
  %1 = call i32 @llvm.scmp(i32 %x, i32 %y)
  ret i32 %1
}

define i32 @scmp.32.64(i64 %x, i64 %y) nounwind {
; RV32I-LABEL: scmp.32.64:
; RV32I:       # %bb.0:
; RV32I-NEXT:    beq a1, a3, .LBB5_2
; RV32I-NEXT:  # %bb.1:
; RV32I-NEXT:    slt a4, a3, a1
; RV32I-NEXT:    slt a0, a1, a3
; RV32I-NEXT:    sub a0, a4, a0
; RV32I-NEXT:    ret
; RV32I-NEXT:  .LBB5_2:
; RV32I-NEXT:    sltu a4, a2, a0
; RV32I-NEXT:    sltu a0, a0, a2
; RV32I-NEXT:    sub a0, a4, a0
; RV32I-NEXT:    ret
;
; RV64I-LABEL: scmp.32.64:
; RV64I:       # %bb.0:
; RV64I-NEXT:    slt a2, a1, a0
; RV64I-NEXT:    slt a0, a0, a1
; RV64I-NEXT:    subw a0, a2, a0
; RV64I-NEXT:    ret
  %1 = call i32 @llvm.scmp(i64 %x, i64 %y)
  ret i32 %1
}

define i64 @scmp.64.64(i64 %x, i64 %y) nounwind {
; RV32I-LABEL: scmp.64.64:
; RV32I:       # %bb.0:
; RV32I-NEXT:    beq a1, a3, .LBB6_2
; RV32I-NEXT:  # %bb.1:
; RV32I-NEXT:    slt a4, a3, a1
; RV32I-NEXT:    slt a1, a1, a3
; RV32I-NEXT:    j .LBB6_3
; RV32I-NEXT:  .LBB6_2:
; RV32I-NEXT:    sltu a4, a2, a0
; RV32I-NEXT:    sltu a1, a0, a2
; RV32I-NEXT:  .LBB6_3:
; RV32I-NEXT:    sub a0, a4, a1
; RV32I-NEXT:    sltu a1, a4, a1
; RV32I-NEXT:    neg a1, a1
; RV32I-NEXT:    ret
;
; RV64I-LABEL: scmp.64.64:
; RV64I:       # %bb.0:
; RV64I-NEXT:    slt a2, a1, a0
; RV64I-NEXT:    slt a0, a0, a1
; RV64I-NEXT:    sub a0, a2, a0
; RV64I-NEXT:    ret
  %1 = call i64 @llvm.scmp(i64 %x, i64 %y)
  ret i64 %1
}