From: Jan Beulich Date: Fri, 30 Aug 2024 09:24:19 +0000 (+0200) Subject: x86: replace conditional operators used to calculate booleans X-Git-Tag: gdb-16-branchpoint~1027 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ca6f0a61e78dd3b7f26dcffa3ec21eb81b6c525c;p=thirdparty%2Fbinutils-gdb.git x86: replace conditional operators used to calculate booleans The boolean expressions themselves are fine to use there. --- diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index a9a0c3fd22e..1956a2060f2 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)