* [PATCH] s390: Fix constraint for insn *cmphi_ccu
@ 2023-10-25 9:27 Stefan Schulze Frielinghaus
2023-11-27 9:12 ` Stefan Schulze Frielinghaus
0 siblings, 1 reply; 3+ messages in thread
From: Stefan Schulze Frielinghaus @ 2023-10-25 9:27 UTC (permalink / raw)
To: krebbel, gcc-patches; +Cc: Stefan Schulze Frielinghaus
Currently for an unsigned 16-bit comparison between memory and an
immediate where the high bit is set, a clc is emitted. This is because
the constant is created for mode HI and therefore sign extended. This
means constraint D does not hold anymore. Since the mode already
restricts the immediate to 16 bit, it is enough to make use of
constraint n and chop of the high bits in the output template.
Bootstrapped and regtested on s390. Ok for mainline?
gcc/ChangeLog:
* config/s390/s390.md (*cmphi_ccu): For immediate operand 1 make
use of constraint n instead of D and chop of high bits in the
output template.
---
gcc/config/s390/s390.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md
index 3f29ba21442..777a20f8e77 100644
--- a/gcc/config/s390/s390.md
+++ b/gcc/config/s390/s390.md
@@ -1355,13 +1355,13 @@
(define_insn "*cmphi_ccu"
[(set (reg CC_REGNUM)
(compare (match_operand:HI 0 "nonimmediate_operand" "d,d,Q,Q,BQ")
- (match_operand:HI 1 "general_operand" "Q,S,D,BQ,Q")))]
+ (match_operand:HI 1 "general_operand" "Q,S,n,BQ,Q")))]
"s390_match_ccmode (insn, CCUmode)
&& !register_operand (operands[1], HImode)"
"@
clm\t%0,3,%S1
clmy\t%0,3,%S1
- clhhsi\t%0,%1
+ clhhsi\t%0,%x1
#
#"
[(set_attr "op_type" "RS,RSY,SIL,SS,SS")
--
2.41.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] s390: Fix constraint for insn *cmphi_ccu
2023-10-25 9:27 [PATCH] s390: Fix constraint for insn *cmphi_ccu Stefan Schulze Frielinghaus
@ 2023-11-27 9:12 ` Stefan Schulze Frielinghaus
2023-11-27 9:20 ` Andreas Krebbel
0 siblings, 1 reply; 3+ messages in thread
From: Stefan Schulze Frielinghaus @ 2023-11-27 9:12 UTC (permalink / raw)
To: krebbel, gcc-patches
Ping.
On Wed, Oct 25, 2023 at 11:27:33AM +0200, Stefan Schulze Frielinghaus wrote:
> Currently for an unsigned 16-bit comparison between memory and an
> immediate where the high bit is set, a clc is emitted. This is because
> the constant is created for mode HI and therefore sign extended. This
> means constraint D does not hold anymore. Since the mode already
> restricts the immediate to 16 bit, it is enough to make use of
> constraint n and chop of the high bits in the output template.
>
> Bootstrapped and regtested on s390. Ok for mainline?
>
> gcc/ChangeLog:
>
> * config/s390/s390.md (*cmphi_ccu): For immediate operand 1 make
> use of constraint n instead of D and chop of high bits in the
> output template.
> ---
> gcc/config/s390/s390.md | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md
> index 3f29ba21442..777a20f8e77 100644
> --- a/gcc/config/s390/s390.md
> +++ b/gcc/config/s390/s390.md
> @@ -1355,13 +1355,13 @@
> (define_insn "*cmphi_ccu"
> [(set (reg CC_REGNUM)
> (compare (match_operand:HI 0 "nonimmediate_operand" "d,d,Q,Q,BQ")
> - (match_operand:HI 1 "general_operand" "Q,S,D,BQ,Q")))]
> + (match_operand:HI 1 "general_operand" "Q,S,n,BQ,Q")))]
> "s390_match_ccmode (insn, CCUmode)
> && !register_operand (operands[1], HImode)"
> "@
> clm\t%0,3,%S1
> clmy\t%0,3,%S1
> - clhhsi\t%0,%1
> + clhhsi\t%0,%x1
> #
> #"
> [(set_attr "op_type" "RS,RSY,SIL,SS,SS")
> --
> 2.41.0
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] s390: Fix constraint for insn *cmphi_ccu
2023-11-27 9:12 ` Stefan Schulze Frielinghaus
@ 2023-11-27 9:20 ` Andreas Krebbel
0 siblings, 0 replies; 3+ messages in thread
From: Andreas Krebbel @ 2023-11-27 9:20 UTC (permalink / raw)
To: Stefan Schulze Frielinghaus, gcc-patches
Ok, thanks!
Andreas
On 11/27/23 10:12, Stefan Schulze Frielinghaus wrote:
> Ping.
>
> On Wed, Oct 25, 2023 at 11:27:33AM +0200, Stefan Schulze Frielinghaus wrote:
>> Currently for an unsigned 16-bit comparison between memory and an
>> immediate where the high bit is set, a clc is emitted. This is because
>> the constant is created for mode HI and therefore sign extended. This
>> means constraint D does not hold anymore. Since the mode already
>> restricts the immediate to 16 bit, it is enough to make use of
>> constraint n and chop of the high bits in the output template.
>>
>> Bootstrapped and regtested on s390. Ok for mainline?
>>
>> gcc/ChangeLog:
>>
>> * config/s390/s390.md (*cmphi_ccu): For immediate operand 1 make
>> use of constraint n instead of D and chop of high bits in the
>> output template.
>> ---
>> gcc/config/s390/s390.md | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md
>> index 3f29ba21442..777a20f8e77 100644
>> --- a/gcc/config/s390/s390.md
>> +++ b/gcc/config/s390/s390.md
>> @@ -1355,13 +1355,13 @@
>> (define_insn "*cmphi_ccu"
>> [(set (reg CC_REGNUM)
>> (compare (match_operand:HI 0 "nonimmediate_operand" "d,d,Q,Q,BQ")
>> - (match_operand:HI 1 "general_operand" "Q,S,D,BQ,Q")))]
>> + (match_operand:HI 1 "general_operand" "Q,S,n,BQ,Q")))]
>> "s390_match_ccmode (insn, CCUmode)
>> && !register_operand (operands[1], HImode)"
>> "@
>> clm\t%0,3,%S1
>> clmy\t%0,3,%S1
>> - clhhsi\t%0,%1
>> + clhhsi\t%0,%x1
>> #
>> #"
>> [(set_attr "op_type" "RS,RSY,SIL,SS,SS")
>> --
>> 2.41.0
>>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-11-27 9:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-25 9:27 [PATCH] s390: Fix constraint for insn *cmphi_ccu Stefan Schulze Frielinghaus
2023-11-27 9:12 ` Stefan Schulze Frielinghaus
2023-11-27 9:20 ` Andreas Krebbel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).