Skip to content

Commit 7a2ab87

Browse files
committed
[Hexagon] Fix fshl/fshr -> combine() bug identified in D75114
1 parent f78b9a3 commit 7a2ab87

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

llvm/lib/Target/Hexagon/HexagonPatterns.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,7 +1095,7 @@ def Divu64_8: SDNodeXForm<imm, [{
10951095
// Special cases:
10961096
let AddedComplexity = 100 in {
10971097
def: Pat<(fshl I32:$Rs, I32:$Rt, (i32 16)),
1098-
(A2_combine_hl I32:$Rs, I32:$Rt)>;
1098+
(A2_combine_lh I32:$Rs, I32:$Rt)>;
10991099
def: Pat<(fshl I64:$Rs, I64:$Rt, IsMul8_U3:$S),
11001100
(S2_valignib I64:$Rs, I64:$Rt, (Divu64_8 $S))>;
11011101
}
@@ -1129,7 +1129,7 @@ def FShr64r: OutPatFrag<(ops node:$Rs, node:$Rt, node:$Ru),
11291129
// Special cases:
11301130
let AddedComplexity = 100 in {
11311131
def: Pat<(fshr I32:$Rs, I32:$Rt, (i32 16)),
1132-
(A2_combine_hl I32:$Rs, I32:$Rt)>;
1132+
(A2_combine_lh I32:$Rs, I32:$Rt)>;
11331133
def: Pat<(fshr I64:$Rs, I64:$Rt, IsMul8_U3:$S),
11341134
(S2_valignib I64:$Rs, I64:$Rt, (Divu8 $S))>;
11351135
}

llvm/test/CodeGen/Hexagon/funnel-shift.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,15 +257,15 @@ b0:
257257
}
258258

259259
; CHECK-LABEL: f30:
260-
; CHECK: r[[R00:[0-9]+]] = combine(r0.h,r1.l)
260+
; CHECK: r[[R00:[0-9]+]] = combine(r0.l,r1.h)
261261
define i32 @f30(i32 %a0, i32 %a1) #1 {
262262
b0:
263263
%v0 = tail call i32 @llvm.fshl.i32(i32 %a0, i32 %a1, i32 16)
264264
ret i32 %v0
265265
}
266266

267267
; CHECK-LABEL: f31:
268-
; CHECK: r[[R00:[0-9]+]] = combine(r0.h,r1.l)
268+
; CHECK: r[[R00:[0-9]+]] = combine(r0.l,r1.h)
269269
define i32 @f31(i32 %a0, i32 %a1) #1 {
270270
b0:
271271
%v0 = tail call i32 @llvm.fshr.i32(i32 %a0, i32 %a1, i32 16)

0 commit comments

Comments
 (0)