File tree Expand file tree Collapse file tree 3 files changed +7
-5
lines changed
test/CodeGen/RISCV/GlobalISel Expand file tree Collapse file tree 3 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -466,7 +466,7 @@ RISCVLegalizerInfo::RISCVLegalizerInfo(const RISCVSubtarget &ST)
466
466
467
467
auto &AbsActions = getActionDefinitionsBuilder (G_ABS);
468
468
if (ST.hasStdExtZbb ())
469
- AbsActions.customFor ({sXLen }).minScalar (0 , sXLen );
469
+ AbsActions.customFor ({s32, sXLen }).minScalar (0 , sXLen );
470
470
AbsActions.lower ();
471
471
472
472
auto &MinMaxActions =
Original file line number Diff line number Diff line change @@ -108,8 +108,8 @@ define i32 @abs32(i32 %x) {
108
108
;
109
109
; RV64ZBB-LABEL: abs32:
110
110
; RV64ZBB: # %bb.0:
111
+ ; RV64ZBB-NEXT: negw a1, a0
111
112
; RV64ZBB-NEXT: sext.w a0, a0
112
- ; RV64ZBB-NEXT: neg a1, a0
113
113
; RV64ZBB-NEXT: max a0, a0, a1
114
114
; RV64ZBB-NEXT: ret
115
115
%abs = tail call i32 @llvm.abs.i32 (i32 %x , i1 true )
Original file line number Diff line number Diff line change @@ -102,9 +102,11 @@ body: |
102
102
; RV64ZBB-LABEL: name: abs_i32
103
103
; RV64ZBB: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
104
104
; RV64ZBB-NEXT: [[ASSERT_SEXT:%[0-9]+]]:_(s64) = G_ASSERT_SEXT [[COPY]], 32
105
- ; RV64ZBB-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
106
- ; RV64ZBB-NEXT: [[SUB:%[0-9]+]]:_(s64) = G_SUB [[C]], [[ASSERT_SEXT]]
107
- ; RV64ZBB-NEXT: [[SMAX:%[0-9]+]]:_(s64) = G_SMAX [[ASSERT_SEXT]], [[SUB]]
105
+ ; RV64ZBB-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[ASSERT_SEXT]](s64)
106
+ ; RV64ZBB-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
107
+ ; RV64ZBB-NEXT: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[C]], [[TRUNC]]
108
+ ; RV64ZBB-NEXT: [[SEXT:%[0-9]+]]:_(s64) = G_SEXT [[SUB]](s32)
109
+ ; RV64ZBB-NEXT: [[SMAX:%[0-9]+]]:_(s64) = G_SMAX [[ASSERT_SEXT]], [[SEXT]]
108
110
; RV64ZBB-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s64) = G_SEXT_INREG [[SMAX]], 32
109
111
; RV64ZBB-NEXT: $x10 = COPY [[SEXT_INREG]](s64)
110
112
; RV64ZBB-NEXT: PseudoRET implicit $x10
You can’t perform that action at this time.
0 commit comments