Skip to content

Commit 553cfa8

Browse files
committed
[VectorCombine] Add test showing exisiting behaviour adding unneeded freeze.
1 parent 15d11eb commit 553cfa8

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

llvm/test/Transforms/VectorCombine/AArch64/ext-extract.ll

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,3 +346,38 @@ entry:
346346
call void @use.i32(i32 %ext.3)
347347
ret void
348348
}
349+
350+
define noundef i32 @zext_v4i8_all_lanes_used_no_freeze(<4 x i8> %src) {
351+
; CHECK-LABEL: define noundef i32 @zext_v4i8_all_lanes_used_no_freeze(
352+
; CHECK-SAME: <4 x i8> [[SRC:%.*]]) {
353+
; CHECK-NEXT: [[ENTRY:.*:]]
354+
; CHECK-NEXT: [[TMP0:%.*]] = freeze <4 x i8> [[SRC]]
355+
; CHECK-NEXT: [[TMP1:%.*]] = bitcast <4 x i8> [[TMP0]] to i32
356+
; CHECK-NEXT: [[TMP2:%.*]] = lshr i32 [[TMP1]], 24
357+
; CHECK-NEXT: [[TMP3:%.*]] = lshr i32 [[TMP1]], 16
358+
; CHECK-NEXT: [[TMP4:%.*]] = and i32 [[TMP3]], 255
359+
; CHECK-NEXT: [[TMP5:%.*]] = lshr i32 [[TMP1]], 8
360+
; CHECK-NEXT: [[TMP6:%.*]] = and i32 [[TMP5]], 255
361+
; CHECK-NEXT: [[TMP7:%.*]] = and i32 [[TMP1]], 255
362+
; CHECK-NEXT: [[EXT:%.*]] = zext nneg <4 x i8> [[SRC]] to <4 x i32>
363+
; CHECK-NEXT: [[EXT_0:%.*]] = extractelement <4 x i32> [[EXT]], i64 0
364+
; CHECK-NEXT: [[EXT_1:%.*]] = extractelement <4 x i32> [[EXT]], i64 1
365+
; CHECK-NEXT: [[EXT_2:%.*]] = extractelement <4 x i32> [[EXT]], i64 2
366+
; CHECK-NEXT: [[EXT_3:%.*]] = extractelement <4 x i32> [[EXT]], i64 3
367+
; CHECK-NEXT: [[ADD1:%.*]] = add i32 [[TMP7]], [[TMP6]]
368+
; CHECK-NEXT: [[ADD2:%.*]] = add i32 [[ADD1]], [[TMP4]]
369+
; CHECK-NEXT: [[ADD3:%.*]] = add i32 [[ADD2]], [[TMP2]]
370+
; CHECK-NEXT: ret i32 [[ADD3]]
371+
;
372+
entry:
373+
%ext = zext nneg <4 x i8> %src to <4 x i32>
374+
%ext.0 = extractelement <4 x i32> %ext, i64 0
375+
%ext.1 = extractelement <4 x i32> %ext, i64 1
376+
%ext.2 = extractelement <4 x i32> %ext, i64 2
377+
%ext.3 = extractelement <4 x i32> %ext, i64 3
378+
379+
%add1 = add i32 %ext.0, %ext.1
380+
%add2 = add i32 %add1, %ext.2
381+
%add3 = add i32 %add2, %ext.3
382+
ret i32 %add3
383+
}

0 commit comments

Comments
 (0)