Skip to content

Commit 86029e6

Browse files
committed
[LoongArch] Modify lround test. NFC
1 parent 479fc75 commit 86029e6

File tree

3 files changed

+20
-24
lines changed

3 files changed

+20
-24
lines changed

llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3106,10 +3106,10 @@ void LoongArchTargetLowering::ReplaceNodeResults(
31063106
}
31073107
case ISD::LROUND: {
31083108
SDValue Op0 = N->getOperand(0);
3109+
EVT OpVT = Op0.getValueType();
31093110
RTLIB::Libcall LC =
3110-
Op0.getValueType() == MVT::f64 ? RTLIB::LROUND_F64 : RTLIB::LROUND_F32;
3111+
OpVT == MVT::f64 ? RTLIB::LROUND_F64 : RTLIB::LROUND_F32;
31113112
MakeLibCallOptions CallOptions;
3112-
EVT OpVT = Op0.getValueType();
31133113
CallOptions.setTypeListBeforeSoften(OpVT, MVT::i64, true);
31143114
SDValue Result = makeLibCall(DAG, LC, MVT::i64, Op0, CallOptions, DL).first;
31153115
Result = DAG.getNode(ISD::TRUNCATE, DL, MVT::i32, Result);
Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
2-
; RUN: llc --mtriple=loongarch64 --mattr=-f,-d %s -o - \
3-
; RUN: | FileCheck -check-prefix=LA64S %s
2+
; RUN: llc --mtriple=loongarch64 %s -o - | FileCheck %s
43

54
declare i32 @llvm.lround.i32.f64(double)
65

76
;; We support lround with i32 as return type on LoongArch64. This is needed by flang.
87
define i32 @lround_i32_f64(double %a) nounwind {
9-
; LA64S-LABEL: lround_i32_f64:
10-
; LA64S: # %bb.0:
11-
; LA64S-NEXT: addi.d $sp, $sp, -16
12-
; LA64S-NEXT: st.d $ra, $sp, 8 # 8-byte Folded Spill
13-
; LA64S-NEXT: bl %plt(lround)
14-
; LA64S-NEXT: ld.d $ra, $sp, 8 # 8-byte Folded Reload
15-
; LA64S-NEXT: addi.d $sp, $sp, 16
16-
; LA64S-NEXT: ret
17-
8+
; CHECK-LABEL: lround_i32_f64:
9+
; CHECK: # %bb.0:
10+
; CHECK-NEXT: addi.d $sp, $sp, -16
11+
; CHECK-NEXT: st.d $ra, $sp, 8 # 8-byte Folded Spill
12+
; CHECK-NEXT: bl %plt(lround)
13+
; CHECK-NEXT: ld.d $ra, $sp, 8 # 8-byte Folded Reload
14+
; CHECK-NEXT: addi.d $sp, $sp, 16
15+
; CHECK-NEXT: ret
1816
%1 = call i32 @llvm.lround.i32.f64(double %a)
1917
ret i32 %1
2018
}
Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
2-
; RUN: llc --mtriple=loongarch64 --mattr=-f,-d %s -o - \
3-
; RUN: | FileCheck -check-prefix=LA64S %s
2+
; RUN: llc --mtriple=loongarch64 %s -o - | FileCheck %s
43

54
declare i32 @llvm.lround.i32.f32(float)
65

76
; We support lround with i32 as return type on LoongArch64. This is needed by flang.
87
define i32 @lround_i32_f32(float %a) nounwind {
9-
; LA64S-LABEL: lround_i32_f32:
10-
; LA64S: # %bb.0:
11-
; LA64S-NEXT: addi.d $sp, $sp, -16
12-
; LA64S-NEXT: st.d $ra, $sp, 8 # 8-byte Folded Spill
13-
; LA64S-NEXT: bl %plt(lroundf)
14-
; LA64S-NEXT: ld.d $ra, $sp, 8 # 8-byte Folded Reload
15-
; LA64S-NEXT: addi.d $sp, $sp, 16
16-
; LA64S-NEXT: ret
17-
8+
; CHECK-LABEL: lround_i32_f32:
9+
; CHECK: # %bb.0:
10+
; CHECK-NEXT: addi.d $sp, $sp, -16
11+
; CHECK-NEXT: st.d $ra, $sp, 8 # 8-byte Folded Spill
12+
; CHECK-NEXT: bl %plt(lroundf)
13+
; CHECK-NEXT: ld.d $ra, $sp, 8 # 8-byte Folded Reload
14+
; CHECK-NEXT: addi.d $sp, $sp, 16
15+
; CHECK-NEXT: ret
1816
%1 = call i32 @llvm.lround.i32.f32(float %a)
1917
ret i32 %1
2018
}

0 commit comments

Comments
 (0)