aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2024-08-30 11:24:19 +0200
committerJan Beulich <jbeulich@suse.com>2024-08-30 11:24:19 +0200
commitca6f0a61e78dd3b7f26dcffa3ec21eb81b6c525c (patch)
tree8618237cf7ce4a793b69638c93dd4a74bfc07e94
parent5d67152772f2b6d9130cd1d3f4bfc11e45a4a9c7 (diff)
downloadbinutils-ca6f0a61e78dd3b7f26dcffa3ec21eb81b6c525c.zip
binutils-ca6f0a61e78dd3b7f26dcffa3ec21eb81b6c525c.tar.gz
binutils-ca6f0a61e78dd3b7f26dcffa3ec21eb81b6c525c.tar.bz2
x86: replace conditional operators used to calculate booleans
The boolean expressions themselves are fine to use there.
-rw-r--r--gas/config/tc-i386.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index a9a0c3f..1956a20 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -4037,7 +4037,7 @@ build_vex_prefix (const insn_template *t)
{
unsigned int register_specifier;
unsigned int vector_length;
- unsigned int w;
+ bool w;
/* Check register specifier. */
if (i.vex.register_specifier)
@@ -4136,11 +4136,11 @@ build_vex_prefix (const insn_template *t)
/* Check the REX.W bit and VEXW. */
if (i.tm.opcode_modifier.vexw == VEXWIG)
- w = (vexwig == vexw1 || (i.rex & REX_W)) ? 1 : 0;
+ w = vexwig == vexw1 || (i.rex & REX_W);
else if (i.tm.opcode_modifier.vexw && !(i.rex & REX_W))
- w = i.tm.opcode_modifier.vexw == VEXW1 ? 1 : 0;
+ w = i.tm.opcode_modifier.vexw == VEXW1;
else
- w = (flag_code == CODE_64BIT ? i.rex & REX_W : vexwig == vexw1) ? 1 : 0;
+ w = flag_code == CODE_64BIT ? i.rex & REX_W : vexwig == vexw1;
/* Use 2-byte VEX prefix if possible. */
if (w == 0
@@ -4149,13 +4149,13 @@ build_vex_prefix (const insn_template *t)
&& (i.rex & (REX_W | REX_X | REX_B)) == 0)
{
/* 2-byte VEX prefix. */
- unsigned int r;
+ bool r;
i.vex.length = 2;
i.vex.bytes[0] = 0xc5;
/* Check the REX.R bit. */
- r = (i.rex & REX_R) ? 0 : 1;
+ r = !(i.rex & REX_R);
i.vex.bytes[1] = (r << 7
| register_specifier << 3
| vector_length << 2
@@ -4293,7 +4293,8 @@ get_broadcast_bytes (const insn_template *t, bool diag)
static void
build_evex_prefix (void)
{
- unsigned int register_specifier, w;
+ unsigned int register_specifier;
+ bool w;
rex_byte vrex_used = 0;
/* Check register specifier. */
@@ -4360,11 +4361,11 @@ build_evex_prefix (void)
/* Check the REX.W bit and VEXW. */
if (i.tm.opcode_modifier.vexw == VEXWIG)
- w = (evexwig == evexw1 || (i.rex & REX_W)) ? 1 : 0;
+ w = evexwig == evexw1 || (i.rex & REX_W);
else if (i.tm.opcode_modifier.vexw && !(i.rex & REX_W))
- w = i.tm.opcode_modifier.vexw == VEXW1 ? 1 : 0;
+ w = i.tm.opcode_modifier.vexw == VEXW1;
else
- w = (flag_code == CODE_64BIT ? i.rex & REX_W : evexwig == evexw1) ? 1 : 0;
+ w = flag_code == CODE_64BIT ? i.rex & REX_W : evexwig == evexw1;
/* The third byte of the EVEX prefix. */
i.vex.bytes[2] = ((w << 7)