Skip to content

[NFC] Fix test for zext(shl(trunc)) fold #113778

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions llvm/test/Transforms/InstCombine/trunc-shl-zext.ll
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
; RUN: opt < %s -passes=instcombine -S | FileCheck %s

target datalayout = "n8:16:32:64"

define i32 @trunc_shl_zext_32(i32 %a) {
; CHECK-LABEL: define i32 @trunc_shl_zext_32
; CHECK-SAME: (i32 [[A:%.*]]) {
; CHECK-NEXT: [[TRUNC:%.*]] = trunc i32 [[A]] to i16
; CHECK-NEXT: [[SHL:%.*]] = shl i16 [[TRUNC]], 4
; CHECK-NEXT: [[EXT:%.*]] = zext i16 [[SHL]] to i32
; CHECK-NEXT: [[SHL:%.*]] = shl i32 [[A]], 4
; CHECK-NEXT: [[EXT:%.*]] = and i32 [[SHL]], 65520
; CHECK-NEXT: ret i32 [[EXT]]
;
%trunc = trunc i32 %a to i16
Expand All @@ -18,9 +19,8 @@ define i32 @trunc_shl_zext_32(i32 %a) {
define i64 @trunc_shl_zext_64(i64 %a) {
; CHECK-LABEL: define i64 @trunc_shl_zext_64
; CHECK-SAME: (i64 [[A:%.*]]) {
; CHECK-NEXT: [[TRUNC:%.*]] = trunc i64 [[A]] to i8
; CHECK-NEXT: [[SHL:%.*]] = shl i8 [[TRUNC]], 7
; CHECK-NEXT: [[EXT:%.*]] = zext i8 [[SHL]] to i64
; CHECK-NEXT: [[SHL:%.*]] = shl i64 [[A]], 7
; CHECK-NEXT: [[EXT:%.*]] = and i64 [[SHL]], 128
; CHECK-NEXT: ret i64 [[EXT]]
;
%trunc = trunc i64 %a to i8
Expand Down
Loading