forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merged main:be5ecc35efc902a4742669d41a88cfd88babb245 into amd-gfx:fee…
…3baa081ca Local branch amd-gfx fee3baa Merged main:99b85cae628c1cc5641944290712cd84ccf1f6c8 into amd-gfx:f09ee8740921 Remote branch main be5ecc3 [RISCV] Dont move source if passthru already dominates in vmv.v.v peephole (llvm#105792)
- Loading branch information
Showing
6 changed files
with
134 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 3 | ||
# RUN: llc %s -o - -mtriple=riscv64 -mattr=+v -run-pass=riscv-vector-peephole \ | ||
# RUN: -verify-machineinstrs | FileCheck %s | ||
|
||
--- | ||
name: move_src | ||
body: | | ||
bb.0: | ||
liveins: $v8 | ||
; CHECK-LABEL: name: move_src | ||
; CHECK: liveins: $v8 | ||
; CHECK-NEXT: {{ $}} | ||
; CHECK-NEXT: %passthru:vr = COPY $v8 | ||
; CHECK-NEXT: %x:vr = PseudoVADD_VV_M1 %passthru, $noreg, $noreg, 4, 5 /* e32 */, 0 /* tu, mu */ | ||
; CHECK-NEXT: %y:gpr = ADDI $x0, 1 | ||
%x:vr = PseudoVADD_VV_M1 $noreg, $noreg, $noreg, 4, 5 /* e32 */, 0 /* tu, mu */ | ||
%passthru:vr = COPY $v8 | ||
%y:gpr = ADDI $x0, 1 | ||
%z:vr = PseudoVMV_V_V_M1 %passthru, %x, 4, 5 /* e32 */, 0 /* tu, mu */ | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py | ||
; RUN: opt < %s -passes=instcombine -S | FileCheck %s | ||
|
||
define i8 @fold_select_trunc_nuw_true(i8 %x, i8 %y) { | ||
; CHECK-LABEL: @fold_select_trunc_nuw_true( | ||
; CHECK-NEXT: [[TRUNC:%.*]] = trunc nuw i8 [[X:%.*]] to i1 | ||
; CHECK-NEXT: [[RET:%.*]] = select i1 [[TRUNC]], i8 1, i8 [[Y:%.*]] | ||
; CHECK-NEXT: ret i8 [[RET]] | ||
; | ||
%trunc = trunc nuw i8 %x to i1 | ||
%ret = select i1 %trunc, i8 %x, i8 %y | ||
ret i8 %ret | ||
} | ||
|
||
define i8 @fold_select_trunc_nuw_false(i8 %x, i8 %y) { | ||
; CHECK-LABEL: @fold_select_trunc_nuw_false( | ||
; CHECK-NEXT: [[TRUNC:%.*]] = trunc nuw i8 [[X:%.*]] to i1 | ||
; CHECK-NEXT: [[RET:%.*]] = select i1 [[TRUNC]], i8 [[Y:%.*]], i8 0 | ||
; CHECK-NEXT: ret i8 [[RET]] | ||
; | ||
%trunc = trunc nuw i8 %x to i1 | ||
%ret = select i1 %trunc, i8 %y, i8 %x | ||
ret i8 %ret | ||
} | ||
|
||
define i128 @fold_select_trunc_nsw_true(i128 %x, i128 %y) { | ||
; CHECK-LABEL: @fold_select_trunc_nsw_true( | ||
; CHECK-NEXT: [[TRUNC:%.*]] = trunc nsw i128 [[X:%.*]] to i1 | ||
; CHECK-NEXT: [[RET:%.*]] = select i1 [[TRUNC]], i128 -1, i128 [[Y:%.*]] | ||
; CHECK-NEXT: ret i128 [[RET]] | ||
; | ||
%trunc = trunc nsw i128 %x to i1 | ||
%ret = select i1 %trunc, i128 %x, i128 %y | ||
ret i128 %ret | ||
} | ||
|
||
define i8 @fold_select_trunc_nsw_false(i8 %x, i8 %y) { | ||
; CHECK-LABEL: @fold_select_trunc_nsw_false( | ||
; CHECK-NEXT: [[TRUNC:%.*]] = trunc nsw i8 [[X:%.*]] to i1 | ||
; CHECK-NEXT: [[RET:%.*]] = select i1 [[TRUNC]], i8 [[Y:%.*]], i8 0 | ||
; CHECK-NEXT: ret i8 [[RET]] | ||
; | ||
%trunc = trunc nsw i8 %x to i1 | ||
%ret = select i1 %trunc, i8 %y, i8 %x | ||
ret i8 %ret | ||
} | ||
|
||
define i8 @fold_select_trunc_negative(i8 %x, i8 %y) { | ||
; CHECK-LABEL: @fold_select_trunc_negative( | ||
; CHECK-NEXT: [[TRUNC:%.*]] = trunc i8 [[X:%.*]] to i1 | ||
; CHECK-NEXT: [[RET:%.*]] = select i1 [[TRUNC]], i8 [[X]], i8 [[Y:%.*]] | ||
; CHECK-NEXT: ret i8 [[RET]] | ||
; | ||
%trunc = trunc i8 %x to i1 | ||
%ret = select i1 %trunc, i8 %x, i8 %y | ||
ret i8 %ret | ||
} | ||
|
||
define <2 x i8> @fold_select_trunc_vector(<2 x i8> %x, <2 x i8> %y) { | ||
; CHECK-LABEL: @fold_select_trunc_vector( | ||
; CHECK-NEXT: [[TRUNC:%.*]] = trunc nuw <2 x i8> [[X:%.*]] to <2 x i1> | ||
; CHECK-NEXT: [[RET:%.*]] = select <2 x i1> [[TRUNC]], <2 x i8> <i8 1, i8 1>, <2 x i8> [[Y:%.*]] | ||
; CHECK-NEXT: ret <2 x i8> [[RET]] | ||
; | ||
%trunc = trunc nuw <2 x i8> %x to <2 x i1> | ||
%ret = select <2 x i1> %trunc, <2 x i8> %x, <2 x i8> %y | ||
ret <2 x i8> %ret | ||
} |