Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
jackgallagher-arm committed Aug 16, 2023
1 parent f005f94 commit ab5128c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
19 changes: 11 additions & 8 deletions ext/drx/scatter_gather_aarch64.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@

static int tls_idx;
typedef struct _per_thread_t {
void *scratch_pred_spill_slot; /*!< Storage for spilled predicate register. */
void *scratch_pred_spill_slot; /*!< Storage for spilled predicate register. */
} per_thread_t;

static int drx_scatter_gather_expanded = 0;
Expand Down Expand Up @@ -331,10 +331,10 @@ expand_scalar_plus_vector(void *drcontext, instrlist_t *bb, instr_t *sg_instr,
* need to set all inactive elements to 0.
*/
if (sg_info->index_reg == sg_info->gather_dst_reg) {
/* The dst register is also the index register so we need to preserve the value
* of the active elements so we can use them as offsets.
* We do this by cpying a 0 value into the dst register using the inverse of the
* mask_reg as the governing predicate.
/* The dst register is also the index register so we need to preserve the
* value of the active elements so we can use them as offsets. We do this by
* cpying a 0 value into the dst register using the inverse of the mask_reg as
* the governing predicate.
*/

/* ptrue scratch_pred.b */
Expand All @@ -354,7 +354,8 @@ expand_scalar_plus_vector(void *drcontext, instrlist_t *bb, instr_t *sg_instr,
opnd_create_predicate_reg(scratch_pred, true), OPND_CREATE_INT8(0),
opnd_create_immed_uint(0, OPSZ_1b));
} else {
/* We don't care about any values in the dst register so zero the whole thing. */
/* We don't care about any values in the dst register so zero the whole thing.
*/

/* dup gather_dst_reg.elsz, #0, lsl #0 */
EMIT(dup_sve_shift,
Expand Down Expand Up @@ -394,7 +395,8 @@ expand_scalar_plus_vector(void *drcontext, instrlist_t *bb, instr_t *sg_instr,
sg_info->scalar_value_size, sg_info->extend_amount);

if (sg_info->is_scalar_value_signed) {
const reg_id_t ld_dst = reg_resize_to_opsz(scratch_gpr, sg_info->element_size);
const reg_id_t ld_dst =
reg_resize_to_opsz(scratch_gpr, sg_info->element_size);
switch (sg_info->scalar_value_size) {
case OPSZ_1: EMIT(ldrsb, opnd_create_reg(ld_dst), mem); break;
case OPSZ_2: EMIT(ldrsh, opnd_create_reg(ld_dst), mem); break;
Expand All @@ -414,7 +416,8 @@ expand_scalar_plus_vector(void *drcontext, instrlist_t *bb, instr_t *sg_instr,

/* cpy gather_dst_reg.elsz, scratch_pred/m, scratch_gpr */
EMIT(cpy_sve_pred,
opnd_create_reg_element_vector(sg_info->gather_dst_reg, sg_info->element_size),
opnd_create_reg_element_vector(sg_info->gather_dst_reg,
sg_info->element_size),
opnd_create_predicate_reg(scratch_pred, true),
opnd_create_reg(reg_resize_to_opsz(scratch_gpr, sg_info->element_size)));
} else {
Expand Down
18 changes: 9 additions & 9 deletions suite/tests/client-interface/drx-scattergather-aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -646,20 +646,20 @@ class input_data_t {
test_result_t
test_ld1_scalar_plus_vector()
{
# define TEST_FUNC(ld_instruction) \
[](scalar_plus_vector_test_case_t::test_ptrs_t &ptrs) { \
# define TEST_FUNC(ld_instruction) \
[](scalar_plus_vector_test_case_t::test_ptrs_t &ptrs) { \
asm(/* clang-format off */ \
RESTORE_Z_REGISTERS(z_restore_base) \
RESTORE_P_REGISTERS(p_restore_base) \
ld_instruction "\n" \
SAVE_Z_REGISTERS(z_save_base) \
SAVE_P_REGISTERS(p_save_base) /* clang-format on */ \
: \
: [ base ] "r"(ptrs.base), [ z_restore_base ] "r"(ptrs.z_restore_base), \
[ z_save_base ] "r"(ptrs.z_save_base), \
[ p_restore_base ] "r"(ptrs.p_restore_base), \
[ p_save_base ] "r"(ptrs.p_save_base) \
: ALL_Z_REGS, ALL_P_REGS, "memory"); \
SAVE_P_REGISTERS(p_save_base) /* clang-format on */ \
: \
: [base] "r"(ptrs.base), [z_restore_base] "r"(ptrs.z_restore_base), \
[z_save_base] "r"(ptrs.z_save_base), \
[p_restore_base] "r"(ptrs.p_restore_base), \
[p_save_base] "r"(ptrs.p_save_base) \
: ALL_Z_REGS, ALL_P_REGS, "memory"); \
}

input_data_t input_data;
Expand Down

0 comments on commit ab5128c

Please sign in to comment.