[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 03/27] target/arm: Fix checkpatch brace errors in helper.c
From: |
Fabiano Rosas |
Subject: |
[RFC PATCH 03/27] target/arm: Fix checkpatch brace errors in helper.c |
Date: |
Wed, 4 Jan 2023 18:58:11 -0300 |
Fix this:
ERROR: braces {} are necessary for all arms of this statement
Reviewed-by: Claudio Fontana <cfontana@suse.de>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
target/arm/helper.c | 67 ++++++++++++++++++++++++++++-----------------
1 file changed, 42 insertions(+), 25 deletions(-)
diff --git a/target/arm/helper.c b/target/arm/helper.c
index 18e4680912..ed3da5ada3 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -9147,10 +9147,12 @@ void cpsr_write(CPUARMState *env, uint32_t val,
uint32_t mask,
env->CF = (val >> 29) & 1;
env->VF = (val << 3) & 0x80000000;
}
- if (mask & CPSR_Q)
+ if (mask & CPSR_Q) {
env->QF = ((val & CPSR_Q) != 0);
- if (mask & CPSR_T)
+ }
+ if (mask & CPSR_T) {
env->thumb = ((val & CPSR_T) != 0);
+ }
if (mask & CPSR_IT_0_1) {
env->condexec_bits &= ~3;
env->condexec_bits |= (val >> 25) & 3;
@@ -9355,8 +9357,9 @@ static void switch_mode(CPUARMState *env, int mode)
int i;
old_mode = env->uncached_cpsr & CPSR_M;
- if (mode == old_mode)
+ if (mode == old_mode) {
return;
+ }
if (old_mode == ARM_CPU_MODE_FIQ) {
memcpy(env->fiq_regs, env->regs + 8, 5 * sizeof(uint32_t));
@@ -9962,10 +9965,11 @@ static void arm_cpu_do_interrupt_aarch32(CPUState *cs)
new_mode = ARM_CPU_MODE_UND;
addr = 0x04;
mask = CPSR_I;
- if (env->thumb)
+ if (env->thumb) {
offset = 2;
- else
+ } else {
offset = 4;
+ }
break;
case EXCP_SWI:
new_mode = ARM_CPU_MODE_SVC;
@@ -10756,10 +10760,11 @@ static inline uint16_t add16_sat(uint16_t a, uint16_t
b)
res = a + b;
if (((res ^ a) & 0x8000) && !((a ^ b) & 0x8000)) {
- if (a & 0x8000)
+ if (a & 0x8000) {
res = 0x8000;
- else
+ } else {
res = 0x7fff;
+ }
}
return res;
}
@@ -10771,10 +10776,11 @@ static inline uint8_t add8_sat(uint8_t a, uint8_t b)
res = a + b;
if (((res ^ a) & 0x80) && !((a ^ b) & 0x80)) {
- if (a & 0x80)
+ if (a & 0x80) {
res = 0x80;
- else
+ } else {
res = 0x7f;
+ }
}
return res;
}
@@ -10786,10 +10792,11 @@ static inline uint16_t sub16_sat(uint16_t a, uint16_t
b)
res = a - b;
if (((res ^ a) & 0x8000) && ((a ^ b) & 0x8000)) {
- if (a & 0x8000)
+ if (a & 0x8000) {
res = 0x8000;
- else
+ } else {
res = 0x7fff;
+ }
}
return res;
}
@@ -10801,10 +10808,11 @@ static inline uint8_t sub8_sat(uint8_t a, uint8_t b)
res = a - b;
if (((res ^ a) & 0x80) && ((a ^ b) & 0x80)) {
- if (a & 0x80)
+ if (a & 0x80) {
res = 0x80;
- else
+ } else {
res = 0x7f;
+ }
}
return res;
}
@@ -10822,34 +10830,38 @@ static inline uint16_t add16_usat(uint16_t a,
uint16_t b)
{
uint16_t res;
res = a + b;
- if (res < a)
+ if (res < a) {
res = 0xffff;
+ }
return res;
}
static inline uint16_t sub16_usat(uint16_t a, uint16_t b)
{
- if (a > b)
+ if (a > b) {
return a - b;
- else
+ } else {
return 0;
+ }
}
static inline uint8_t add8_usat(uint8_t a, uint8_t b)
{
uint8_t res;
res = a + b;
- if (res < a)
+ if (res < a) {
res = 0xff;
+ }
return res;
}
static inline uint8_t sub8_usat(uint8_t a, uint8_t b)
{
- if (a > b)
+ if (a > b) {
return a - b;
- else
+ } else {
return 0;
+ }
}
#define ADD16(a, b, n) RESULT(add16_usat(a, b), n, 16);
@@ -10953,10 +10965,11 @@ static inline uint8_t sub8_usat(uint8_t a, uint8_t b)
static inline uint8_t do_usad(uint8_t a, uint8_t b)
{
- if (a > b)
+ if (a > b) {
return a - b;
- else
+ } else {
return b - a;
+ }
}
/* Unsigned sum of absolute byte differences. */
@@ -10976,14 +10989,18 @@ uint32_t HELPER(sel_flags)(uint32_t flags, uint32_t
a, uint32_t b)
uint32_t mask;
mask = 0;
- if (flags & 1)
+ if (flags & 1) {
mask |= 0xff;
- if (flags & 2)
+ }
+ if (flags & 2) {
mask |= 0xff00;
- if (flags & 4)
+ }
+ if (flags & 4) {
mask |= 0xff0000;
- if (flags & 8)
+ }
+ if (flags & 8) {
mask |= 0xff000000;
+ }
return (a & mask) | (b & ~mask);
}
--
2.35.3
- [RFC PATCH 00/27] target/arm: Allow CONFIG_TCG=n builds, Fabiano Rosas, 2023/01/04
- [RFC PATCH 02/27] target/arm: Fix checkpatch space errors in helper.c, Fabiano Rosas, 2023/01/04
- [RFC PATCH 01/27] target/arm: Fix checkpatch comment style warnings in helper.c, Fabiano Rosas, 2023/01/04
- [RFC PATCH 03/27] target/arm: Fix checkpatch brace errors in helper.c,
Fabiano Rosas <=
- [RFC PATCH 07/27] target/arm: rename handle_semihosting to tcg_handle_semihosting, Fabiano Rosas, 2023/01/04
- [RFC PATCH 06/27] target/arm: cleanup cpu includes, Fabiano Rosas, 2023/01/04
- [RFC PATCH 04/27] target/arm: Remove unused includes from m_helper.c, Fabiano Rosas, 2023/01/04
- [RFC PATCH 08/27] target/arm: wrap psci call with tcg_enabled, Fabiano Rosas, 2023/01/04
- [RFC PATCH 05/27] target/arm: Remove unused includes from helper.c, Fabiano Rosas, 2023/01/04
- [RFC PATCH 09/27] target/arm: wrap call to aarch64_sve_change_el in tcg_enabled(), Fabiano Rosas, 2023/01/04
- [RFC PATCH 14/27] target/arm: Move regime_using_lpae_format into internal.h, Fabiano Rosas, 2023/01/04
- [RFC PATCH 15/27] target/arm: move helpers to tcg/, Fabiano Rosas, 2023/01/04