diff mbox series

rs6000: Use ULL on big hexadecimal literal

Message ID 3947efe80d59f015d282c294a87cdb49b1bdeb08.1573595033.git.segher@kernel.crashing.org
State New
Headers show
Series rs6000: Use ULL on big hexadecimal literal | expand

Commit Message

Segher Boessenkool Nov. 12, 2019, 9:52 p.m. UTC
C++98 does not have long long int, and does not use (unsigned) long
long int for hexadecimal literals.  So let's use an ULL suffix here,
which is still not strict C++98, but which works with more compilers.

Tested etc.; committing to trunk.


Segher


2019-11-12  Segher Boessenkool  <segher@kernel.crashing.org>

	* config/rs6000/rs6000.md (rs6000_set_fpscr_drn): Use ULL on big
	hexadecimal literal.

---
 gcc/config/rs6000/rs6000.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Segher Boessenkool Nov. 13, 2019, 10:52 a.m. UTC | #1
On Wed, Nov 13, 2019 at 09:15:38AM +0100, Richard Henderson wrote:
> On 11/12/19 10:52 PM, Segher Boessenkool wrote:
> > C++98 does not have long long int, and does not use (unsigned) long
> > long int for hexadecimal literals.  So let's use an ULL suffix here,
> > which is still not strict C++98, but which works with more compilers.
> 
> Isn't that what HOST_WIDE_INT_UC() is for?
> Of course, that will use either UL or ULL itself...

HOST_WIDE_INT_UC doesn't exactly make the code more readable, IMO.

It is passed here directly to GEN_INT, so as long as the suffix makes it
a big enough type all is well.  There are many occurrences of this in
the tree already, including another in this same file.

Soon we will require C++11 and we won't need any suffixes on hexadecimal
literals anymore, in all common cases (all sane cases one could say).
So we don't have to discuss this anymore :-)


Segher
Segher Boessenkool Nov. 18, 2019, 7:46 p.m. UTC | #2
On Tue, Nov 12, 2019 at 09:52:43PM +0000, Segher Boessenkool wrote:
> C++98 does not have long long int, and does not use (unsigned) long
> long int for hexadecimal literals.  So let's use an ULL suffix here,
> which is still not strict C++98, but which works with more compilers.
> 
> Tested etc.; committing to trunk.

I backported this to GCC 9 branch now.


Segher


> 2019-11-12  Segher Boessenkool  <segher@kernel.crashing.org>
> 
> 	* config/rs6000/rs6000.md (rs6000_set_fpscr_drn): Use ULL on big
> 	hexadecimal literal.
diff mbox series

Patch

diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index 1327285..d165344 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -6008,7 +6008,7 @@  (define_expand "rs6000_set_fpscr_drn"
       /* Insert new RN mode into FSCPR.  */
       emit_insn (gen_rs6000_mffs (tmp_df));
       tmp_di = simplify_gen_subreg (DImode, tmp_df, DFmode, 0);
-      emit_insn (gen_anddi3 (tmp_di, tmp_di, GEN_INT (0xFFFFFFF8FFFFFFFF)));
+      emit_insn (gen_anddi3 (tmp_di, tmp_di, GEN_INT (0xFFFFFFF8FFFFFFFFULL)));
       emit_insn (gen_iordi3 (tmp_di, tmp_di, tmp_rn));
 
       /* Need to write to field 7.  The fields are [0:15].  The equation to