sel1.ll
3.77 KB
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
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -mtriple=mipsel-linux-gnu -mcpu=mips32r2 -O2 -relocation-model=pic \
; RUN: -fast-isel -fast-isel-abort=1 | FileCheck %s
; FIXME: The first xor instruction is redundant.
define i1 @sel_i1(i1 %j, i1 %k, i1 %l) {
; CHECK-LABEL: sel_i1:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: xor $1, $4, $zero
; CHECK-NEXT: andi $1, $1, 1
; CHECK-NEXT: movn $6, $5, $1
; CHECK-NEXT: jr $ra
; CHECK-NEXT: move $2, $6
entry:
%cond = xor i1 %j, false
%res = select i1 %cond, i1 %k, i1 %l
ret i1 %res
}
; FIXME: The seb $X, $zero and xor .., .., $x instructions are redundant.
define i8 @sel_i8(i8 %j, i8 %k, i8 %l) {
; CHECK-LABEL: sel_i8:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: seb $1, $4
; CHECK-NEXT: seb $2, $zero
; CHECK-NEXT: xor $1, $1, $2
; CHECK-NEXT: sltu $1, $zero, $1
; CHECK-NEXT: andi $1, $1, 1
; CHECK-NEXT: movn $6, $5, $1
; CHECK-NEXT: jr $ra
; CHECK-NEXT: move $2, $6
entry:
%cond = icmp ne i8 %j, 0
%res = select i1 %cond, i8 %k, i8 %l
ret i8 %res
}
; FIXME: The seh $X, $zero and xor .., .., $x instructions are redundant.
define i16 @sel_i16(i16 %j, i16 %k, i16 %l) {
; CHECK-LABEL: sel_i16:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: seh $1, $4
; CHECK-NEXT: seh $2, $zero
; CHECK-NEXT: xor $1, $1, $2
; CHECK-NEXT: sltu $1, $zero, $1
; CHECK-NEXT: andi $1, $1, 1
; CHECK-NEXT: movn $6, $5, $1
; CHECK-NEXT: jr $ra
; CHECK-NEXT: move $2, $6
entry:
%cond = icmp ne i16 %j, 0
%res = select i1 %cond, i16 %k, i16 %l
ret i16 %res
}
; FIXME: The first xor instruction is redundant.
define i32 @sel_i32(i32 %j, i32 %k, i32 %l) {
; CHECK-LABEL: sel_i32:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: xor $1, $4, $zero
; CHECK-NEXT: sltu $1, $zero, $1
; CHECK-NEXT: andi $1, $1, 1
; CHECK-NEXT: movn $6, $5, $1
; CHECK-NEXT: jr $ra
; CHECK-NEXT: move $2, $6
entry:
%cond = icmp ne i32 %j, 0
%res = select i1 %cond, i32 %k, i32 %l
ret i32 %res
}
define float @sel_float(i32 %j, float %k, float %l) {
; CHECK-LABEL: sel_float:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: mtc1 $6, $f0
; CHECK-NEXT: mtc1 $5, $f1
; CHECK-NEXT: xor $1, $4, $zero
; CHECK-NEXT: sltu $1, $zero, $1
; CHECK-NEXT: andi $1, $1, 1
; CHECK-NEXT: jr $ra
; CHECK-NEXT: movn.s $f0, $f1, $1
entry:
%cond = icmp ne i32 %j, 0
%res = select i1 %cond, float %k, float %l
ret float %res
}
define float @sel_float2(float %k, float %l, i32 %j) {
; CHECK-LABEL: sel_float2:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: mov.s $f0, $f14
; CHECK-NEXT: xor $1, $6, $zero
; CHECK-NEXT: sltu $1, $zero, $1
; CHECK-NEXT: andi $1, $1, 1
; CHECK-NEXT: jr $ra
; CHECK-NEXT: movn.s $f0, $f12, $1
entry:
%cond = icmp ne i32 %j, 0
%res = select i1 %cond, float %k, float %l
ret float %res
}
define double @sel_double(i32 %j, double %k, double %l) {
; CHECK-LABEL: sel_double:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: mtc1 $6, $f2
; CHECK-NEXT: mthc1 $7, $f2
; CHECK-NEXT: ldc1 $f0, 16($sp)
; CHECK-NEXT: xor $1, $4, $zero
; CHECK-NEXT: sltu $1, $zero, $1
; CHECK-NEXT: andi $1, $1, 1
; CHECK-NEXT: jr $ra
; CHECK-NEXT: movn.d $f0, $f2, $1
entry:
%cond = icmp ne i32 %j, 0
%res = select i1 %cond, double %k, double %l
ret double %res
}
define double @sel_double2(double %k, double %l, i32 %j) {
; CHECK-LABEL: sel_double2:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: mov.d $f0, $f14
; CHECK-NEXT: lw $1, 16($sp)
; CHECK-NEXT: xor $1, $1, $zero
; CHECK-NEXT: sltu $1, $zero, $1
; CHECK-NEXT: andi $1, $1, 1
; CHECK-NEXT: jr $ra
; CHECK-NEXT: movn.d $f0, $f12, $1
entry:
%cond = icmp ne i32 %j, 0
%res = select i1 %cond, double %k, double %l
ret double %res
}