From d5c45ad752d9e7c0b55c3712d2bd92307251c3b7 Mon Sep 17 00:00:00 2001 From: Bernd Edlinger Date: Wed, 23 Nov 2016 21:53:12 +0000 Subject: [PATCH] opth-gen.awk: Use unsigned shifts for bit masks. 2016-11-07 Bernd Edlinger * opth-gen.awk: Use unsigned shifts for bit masks. Allow all bits to be used. Add brackets around macro argument. From-SVN: r242803 --- gcc/ChangeLog | 5 +++++ gcc/opth-gen.awk | 12 ++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a84eb7d9f0e..e6f29db082b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-11-23 Bernd Edlinger + + * opth-gen.awk: Use unsigned shifts for bit masks. Allow all bits + to be used. Add brackets around macro argument. + 2016-11-23 Uros Bizjak * config/i386/i386.md (*hi_1): Fix operand 2 constraints. diff --git a/gcc/opth-gen.awk b/gcc/opth-gen.awk index c728a42ca11..27f414118c2 100644 --- a/gcc/opth-gen.awk +++ b/gcc/opth-gen.awk @@ -350,11 +350,11 @@ for (i = 0; i < n_opts; i++) { mask_bits[name] = 1 vname = var_name(flags[i]) mask = "MASK_" - mask_1 = "1" + mask_1 = "1U" if (vname != "") { mask = "OPTION_MASK_" if (host_wide_int[vname] == "yes") - mask_1 = "HOST_WIDE_INT_1" + mask_1 = "HOST_WIDE_INT_1U" } else extra_mask_bits[name] = 1 print "#define " mask name " (" mask_1 " << " masknum[vname]++ ")" @@ -362,16 +362,16 @@ for (i = 0; i < n_opts; i++) { } for (i = 0; i < n_extra_masks; i++) { if (extra_mask_bits[extra_masks[i]] == 0) - print "#define MASK_" extra_masks[i] " (1 << " masknum[""]++ ")" + print "#define MASK_" extra_masks[i] " (1U << " masknum[""]++ ")" } for (var in masknum) { if (var != "" && host_wide_int[var] == "yes") { - print" #if defined(HOST_BITS_PER_WIDE_INT) && " masknum[var] " >= HOST_BITS_PER_WIDE_INT" + print "#if defined(HOST_BITS_PER_WIDE_INT) && " masknum[var] " > HOST_BITS_PER_WIDE_INT" print "#error too many masks for " var print "#endif" } - else if (masknum[var] > 31) { + else if (masknum[var] > 32) { if (var == "") print "#error too many target masks" else @@ -401,7 +401,7 @@ for (i = 0; i < n_opts; i++) { print "#define TARGET_" name \ " ((" vname " & " mask name ") != 0)" print "#define TARGET_" name "_P(" vname ")" \ - " ((" vname " & " mask name ") != 0)" + " (((" vname ") & " mask name ") != 0)" } } for (i = 0; i < n_extra_masks; i++) { -- 2.30.2