-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[AArch64]SIMD fpcvt codegen for rounding nodes #165546
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
Changes from 2 commits
6377946
cec5513
d74cd15
3821797
0f90db6
ed50a6a
10877d2
21a0c8d
da01d0a
7e1c284
f085f44
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6799,6 +6799,79 @@ defm : FPToIntegerPats<fp_to_uint, fp_to_uint_sat, fp_to_uint_sat_gi, ftrunc, "F | |
| defm : FPToIntegerPats<fp_to_sint, fp_to_sint_sat, fp_to_sint_sat_gi, fround, "FCVTAS">; | ||
| defm : FPToIntegerPats<fp_to_uint, fp_to_uint_sat, fp_to_uint_sat_gi, fround, "FCVTAU">; | ||
|
|
||
| // For global-isel we can use register classes to determine | ||
| // which FCVT instruction to use. | ||
| let Predicates = [HasFPRCVT] in { | ||
| def : Pat<(i64 (any_lround f32:$Rn)), | ||
|
||
| (FCVTASDSr f32:$Rn)>; | ||
| def : Pat<(i64 (any_llround f32:$Rn)), | ||
| (FCVTASDSr f32:$Rn)>; | ||
| } | ||
| def : Pat<(i64 (any_lround f64:$Rn)), | ||
| (FCVTASv1i64 f64:$Rn)>; | ||
| def : Pat<(i64 (any_llround f64:$Rn)), | ||
| (FCVTASv1i64 f64:$Rn)>; | ||
|
|
||
| let Predicates = [HasFPRCVT] in { | ||
| def : Pat<(f32 (bitconvert (i32 (any_lround f16:$Rn)))), | ||
| (FCVTASSHr f16:$Rn)>; | ||
| def : Pat<(f64 (bitconvert (i64 (any_lround f16:$Rn)))), | ||
| (FCVTASDHr f16:$Rn)>; | ||
| def : Pat<(f64 (bitconvert (i64 (any_llround f16:$Rn)))), | ||
| (FCVTASDHr f16:$Rn)>; | ||
| def : Pat<(f64 (bitconvert (i64 (any_lround f32:$Rn)))), | ||
| (FCVTASDSr f32:$Rn)>; | ||
| def : Pat<(f32 (bitconvert (i32 (any_lround f64:$Rn)))), | ||
| (FCVTASSDr f64:$Rn)>; | ||
| def : Pat<(f64 (bitconvert (i64 (any_llround f32:$Rn)))), | ||
| (FCVTASDSr f32:$Rn)>; | ||
| } | ||
| def : Pat<(f32 (bitconvert (i32 (any_lround f32:$Rn)))), | ||
| (FCVTASv1i32 f32:$Rn)>; | ||
| def : Pat<(f64 (bitconvert (i64 (any_lround f64:$Rn)))), | ||
| (FCVTASv1i64 f64:$Rn)>; | ||
| def : Pat<(f64 (bitconvert (i64 (any_llround f64:$Rn)))), | ||
| (FCVTASv1i64 f64:$Rn)>; | ||
|
|
||
| // For global-isel we can use register classes to determine | ||
| // which FCVT instruction to use. | ||
| let Predicates = [HasFPRCVT] in { | ||
| def : Pat<(i64 (any_lrint f16:$Rn)), | ||
| (FCVTZSDHr (FRINTXHr f16:$Rn))>; | ||
| def : Pat<(i64 (any_llrint f16:$Rn)), | ||
| (FCVTZSDHr (FRINTXHr f16:$Rn))>; | ||
| def : Pat<(i64 (any_lrint f32:$Rn)), | ||
| (FCVTZSDSr (FRINTXSr f32:$Rn))>; | ||
| def : Pat<(i64 (any_llrint f32:$Rn)), | ||
| (FCVTZSDSr (FRINTXSr f32:$Rn))>; | ||
| } | ||
| def : Pat<(i64 (any_lrint f64:$Rn)), | ||
| (FCVTZSv1i64 (FRINTXDr f64:$Rn))>; | ||
| def : Pat<(i64 (any_llrint f64:$Rn)), | ||
| (FCVTZSv1i64 (FRINTXDr f64:$Rn))>; | ||
|
|
||
| let Predicates = [HasFPRCVT] in { | ||
| def : Pat<(f32 (bitconvert (i32 (any_lrint f16:$Rn)))), | ||
| (FCVTZSSHr (FRINTXHr f16:$Rn))>; | ||
| def : Pat<(f64 (bitconvert (i64 (any_lrint f16:$Rn)))), | ||
| (FCVTZSDHr (FRINTXHr f16:$Rn))>; | ||
| def : Pat<(f64 (bitconvert (i64 (any_llrint f16:$Rn)))), | ||
| (FCVTZSDHr (FRINTXHr f16:$Rn))>; | ||
| def : Pat<(f64 (bitconvert (i64 (any_lrint f32:$Rn)))), | ||
| (FCVTZSDSr (FRINTXSr f32:$Rn))>; | ||
| def : Pat<(f32 (bitconvert (i32 (any_lrint f64:$Rn)))), | ||
| (FCVTZSSDr (FRINTXDr f64:$Rn))>; | ||
| def : Pat<(f64 (bitconvert (i64 (any_llrint f32:$Rn)))), | ||
| (FCVTZSDSr (FRINTXSr f32:$Rn))>; | ||
| } | ||
| def : Pat<(f32 (bitconvert (i32 (any_lrint f32:$Rn)))), | ||
| (FCVTZSv1i32 (FRINTXSr f32:$Rn))>; | ||
| def : Pat<(f64 (bitconvert (i64 (any_lrint f64:$Rn)))), | ||
| (FCVTZSv1i64 (FRINTXDr f64:$Rn))>; | ||
| def : Pat<(f64 (bitconvert (i64 (any_llrint f64:$Rn)))), | ||
| (FCVTZSv1i64 (FRINTXDr f64:$Rn))>; | ||
|
|
||
|
|
||
| // f16 -> s16 conversions | ||
| let Predicates = [HasFullFP16] in { | ||
| def : Pat<(i16(fp_to_sint_sat_gi f16:$Rn)), (FCVTZSv1f16 f16:$Rn)>; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if it will help, but maybe we could split the PR into patterns only for GlobalISel and another for the standard lowering/SelectionDAG?
I imagine that the ones from lines:
6810 till 6823
and
6848 till 6861
are only for GlobalISel while the other ones are for SelectionDAG
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes all the patterns without bitconvert node are for GlobalISel. May I ask what would be the value in splitting the patch ? As there is only couple of GlobalISel patterns added and the tests can be shared anyway, it makes sense to me to do it in one PR, but I can do that if you insist. The previous patches were also not split and it was fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main reason was to solve the issue raised by @arsenm about the complexity to review of the patch.