Message ID | 3ffcef54-43a4-022f-de36-fd8a5e068bab@codesourcery.com |
---|---|
State | New |
Headers | show |
Series | [amdgcn] Add support for unordered floating-point comparisons | expand |
On 02/04/2020 15:55, Kwok Cheung Yeung wrote: > Hello > > This patch adds support for the unordered floating-point comparison > operators (UNEQ, UNGE, UNGT, UNLE, UNLT), which return true if one of > the operands is a NaN. These comparisons can be generated by builtins > such as __builtin_isgreater. > > GCC 10 appears to have a fall-back if the unordered comparisons are not > available (by generating an unordered comparison first, followed by the > main comparison), whereas previous versions would simply throw an ICE. > Still, it should be a little more efficient to have direct support for > these operators. > > Tested on a GCN3 board with no regressions noted. Okay for trunk? OK, thanks. Andrew
diff --git a/gcc/config/gcn/gcn.c b/gcc/config/gcn/gcn.c index 12438cf..38b5b98 100644 --- a/gcc/config/gcn/gcn.c +++ b/gcc/config/gcn/gcn.c @@ -6007,6 +6007,21 @@ print_operand (FILE *file, rtx x, int code) case UNORDERED: s = "_u_"; break; + case UNEQ: + s = "_nlg_"; + break; + case UNGE: + s = "_nlt_"; + break; + case UNGT: + s = "_nle_"; + break; + case UNLE: + s = "_ngt_"; + break; + case UNLT: + s = "_nge_"; + break; case LTGT: s = "_lg_"; break; diff --git a/gcc/config/gcn/predicates.md b/gcc/config/gcn/predicates.md index 7bf763a..91e5ca1 100644 --- a/gcc/config/gcn/predicates.md +++ b/gcc/config/gcn/predicates.md @@ -165,7 +165,7 @@ (match_code "eq,ne,gt,ge,lt,le,gtu,geu,ltu,leu")) (define_predicate "gcn_fp_compare_operator" - (match_code "eq,ne,gt,ge,lt,le,gtu,geu,ltu,leu,ordered,unordered,ltgt")) + (match_code "eq,ne,gt,ge,lt,le,gtu,geu,ltu,leu,ordered,unordered,uneq,unge,ungt,unle,unlt,ltgt")) (define_predicate "unary_operator" (match_code "not,popcount"))