public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] rs6000: Change bitwise xor to inequality operator [PR106907]
       [not found] <d8e78d8a-b0fc-cb05-04f6-acacb6d83869@linux.vnet.ibm.com>
@ 2023-06-12 11:18 ` P Jeevitha
  2023-06-16  4:25   ` Peter Bergner
  0 siblings, 1 reply; 3+ messages in thread
From: P Jeevitha @ 2023-06-12 11:18 UTC (permalink / raw)
  To: gcc-patches, Peter Bergner, Segher Boessenkool

PR106907 has few warnings spotted from cppcheck. Here we have
warnings for precedence clarification since boolean results are
used in bitwise operation. Bitwise xor performed on bool
is similar to checking inequality. So changed to inequality
operator (!=) instead of bitwise xor (^). And fixed comment indentation

2023-06-12  Jeevitha Palanisamy  <jeevitha@linux.ibm.com>

gcc/
	PR target/106907
	* config/rs6000/rs6000.cc (altivec_expand_vec_perm_const): Change bitwise
	xor to inequality and fix comment indentation.


diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index ea68ca6faef..ea7efda8dcd 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -23396,10 +23396,10 @@ altivec_expand_vec_perm_const (rtx target, rtx op0, rtx op1,
 		      && GET_MODE (XEXP (op0, 0)) != V8HImode)))
 	    continue;
 
-          /* For little-endian, the two input operands must be swapped
-             (or swapped back) to ensure proper right-to-left numbering
-             from 0 to 2N-1.  */
-	  if (swapped ^ !BYTES_BIG_ENDIAN
+	  /* For little-endian, the two input operands must be swapped
+	     (or swapped back) to ensure proper right-to-left numbering
+	     from 0 to 2N-1.  */
+	  if (swapped != !BYTES_BIG_ENDIAN
 	      && icode != CODE_FOR_vsx_xxpermdi_v16qi)
 	    std::swap (op0, op1);
 	  if (imode != V16QImode)




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] rs6000: Change bitwise xor to inequality operator [PR106907]
  2023-06-12 11:18 ` [PATCH] rs6000: Change bitwise xor to inequality operator [PR106907] P Jeevitha
@ 2023-06-16  4:25   ` Peter Bergner
  2023-10-08 18:09     ` [PING^1][PATCH] " jeevitha
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Bergner @ 2023-06-16  4:25 UTC (permalink / raw)
  To: P Jeevitha; +Cc: GCC Patches, Segher Boessenkool

On 6/12/23 6:18 AM, P Jeevitha wrote:
> Bitwise xor performed on bool
> is similar to checking inequality. So changed to inequality
> operator (!=) instead of bitwise xor (^).
[snip'
> -	  if (swapped ^ !BYTES_BIG_ENDIAN
[snip]
> +	  if (swapped != !BYTES_BIG_ENDIAN

I know Andreas mentioned using "swapped != !BYTES_BIG_ENDIAN" in
the bugzilla, but that's the same as "swapped == BYTES_BIG_ENDIAN",
and it doesn't contain a double-negative and seems a little clearer.

It's up to Segher though...and if we go with this, then the ChangeLog
entry needs to be updated slightly since we're no longer testing for
inequality.

Peter


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PING^1][PATCH] rs6000: Change bitwise xor to inequality operator [PR106907]
  2023-06-16  4:25   ` Peter Bergner
@ 2023-10-08 18:09     ` jeevitha
  0 siblings, 0 replies; 3+ messages in thread
From: jeevitha @ 2023-10-08 18:09 UTC (permalink / raw)
  To: GCC Patches, Segher Boessenkool; +Cc: Peter Bergner

Ping!

please review.

Thanks & Regards
Jeevitha

On 16/06/23 9:55 am, Peter Bergner wrote:
> On 6/12/23 6:18 AM, P Jeevitha wrote:
>> Bitwise xor performed on bool
>> is similar to checking inequality. So changed to inequality
>> operator (!=) instead of bitwise xor (^).
> [snip'
>> -	  if (swapped ^ !BYTES_BIG_ENDIAN
> [snip]
>> +	  if (swapped != !BYTES_BIG_ENDIAN
> 
> I know Andreas mentioned using "swapped != !BYTES_BIG_ENDIAN" in
> the bugzilla, but that's the same as "swapped == BYTES_BIG_ENDIAN",
> and it doesn't contain a double-negative and seems a little clearer.
> 
> It's up to Segher though...and if we go with this, then the ChangeLog
> entry needs to be updated slightly since we're no longer testing for
> inequality.
> 
> Peter
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-10-08 18:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <d8e78d8a-b0fc-cb05-04f6-acacb6d83869@linux.vnet.ibm.com>
2023-06-12 11:18 ` [PATCH] rs6000: Change bitwise xor to inequality operator [PR106907] P Jeevitha
2023-06-16  4:25   ` Peter Bergner
2023-10-08 18:09     ` [PING^1][PATCH] " jeevitha

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).