Skip to content

Commit 0f192f2

Browse files
committed
fixes to ssat missing code
1 parent 24a768a commit 0f192f2

4 files changed

Lines changed: 25 additions & 23 deletions

File tree

cmake/flags.cmake

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ set(MSVC_CXX_FLAGS
3131

3232

3333
set(CLANG_CXX_FLAGS
34+
-Werror
35+
-Wall
36+
-Wextra
37+
-Wunused
3438
-Wnon-virtual-dtor
3539
-Wold-style-cast
3640
-Wcast-align
@@ -77,11 +81,7 @@ set(LINUX_RELEASE_CXX_FLAGS
7781
-march=native
7882
-mtune=native
7983
# -fno-omit-frame-pointer for llvm-bolt
80-
-Wall
81-
-Werror
82-
-Wextra
8384
#-Wshadow
84-
-Wunused
8585
-Wno-unused-parameter # TEMPORARY
8686
-Wno-return-type # TEMPORARY
8787
-Wno-unused-variable # TEMPORARY
@@ -98,10 +98,6 @@ set(LINUX_EMBEDDED_CXX_FLAGS
9898
set(LINUX_DEBUG_CXX_FLAGS
9999
-g
100100
-O0
101-
-Werror
102-
-Wall
103-
-Wextra
104-
-Wunused
105101
#-fsanitize=address,undefined,nullability
106102

107103
# for prototyping purposes, should be removed one day

llarm-asm/src/assemble/arm/encoders/special_grouping.cpp

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -197,18 +197,23 @@ u32 generators::saturate_instructions(const arm_id id, const operand_struct& arg
197197

198198

199199
u32 generators::ssat_instruction(const arm_id id, const operand_struct& args) {
200-
// // Fixed bits: 27-25=011, 24-21=0101, 5=1, 4=1
201-
// u32 binary = 0b0000'0110'1010'0000'0000'0000'0011'0000;
202-
//
203-
// llarm::util::swap_bits(binary, 28, 31, args.cond);
204-
// llarm::util::swap_bits(binary, 16, 20, args.first_int - 1); // sat_imm encoded as immed-1
205-
// llarm::util::swap_bits(binary, 12, 15, args.first_reg); // Rd
206-
// llarm::util::swap_bits(binary, 7, 11, args.second_int); // shift_imm
207-
// llarm::util::swap_bits(binary, 0, 3, args.second_reg); // Rm
208-
//
209-
// return binary;
210-
211-
// TODO
200+
if (id == arm_id::SSAT16) {
201+
u32 binary = 0b0000'0110'1010'0000'0000'1111'0011'0000;
202+
llarm::util::swap_bits(binary, 28, 31, args.cond);
203+
llarm::util::swap_bits(binary, 16, 19, args.first_int - 1); // sat_imm
204+
llarm::util::swap_bits(binary, 12, 15, args.first_reg); // Rd
205+
llarm::util::swap_bits(binary, 0, 3, args.second_reg); // Rm
206+
return binary;
207+
}
208+
209+
u32 binary = 0b0000'0110'1010'0000'0000'0000'0001'0000;
210+
llarm::util::swap_bits(binary, 28, 31, args.cond);
211+
llarm::util::swap_bits(binary, 16, 20, args.first_int - 1); // sat_imm
212+
llarm::util::swap_bits(binary, 12, 15, args.first_reg); // Rd
213+
llarm::util::swap_bits(binary, 7, 11, args.second_int); // shift_imm
214+
llarm::util::modify_bit(binary, 6, args.shifter == shifter_id::USAT_ASR); // sh
215+
llarm::util::swap_bits(binary, 0, 3, args.second_reg); // Rm
216+
return binary;
212217
}
213218

214219

llarm-asm/src/identifiers/string_shifters.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ shifter_id ident::string_shifters::vfp_mul_instruction(const lexemes_t& lexemes,
295295
}
296296

297297

298-
shifter_id ident::string_shifters::usat_instruction(const lexemes_t& lexemes) {
298+
shifter_id ident::string_shifters::sat_instruction(const lexemes_t& lexemes) {
299299
using namespace interpreter;
300300

301301
// no shifter
@@ -403,7 +403,8 @@ shifter_id ident::string_shifters::identify_shifter(const lexemes_t& lexemes, co
403403
case arm_id::FLDS: return shifter_id::VFP_LS_MUL_SPECIAL;
404404
case arm_id::FSTD: return shifter_id::VFP_LS_MUL_SPECIAL;
405405
case arm_id::FSTS: return shifter_id::VFP_LS_MUL_SPECIAL;
406-
case arm_id::USAT: return usat_instruction(lexemes);
406+
case arm_id::USAT: return sat_instruction(lexemes);
407+
case arm_id::SSAT: return sat_instruction(lexemes);
407408
default: return shifter_id::NONE;
408409
}
409410
}

llarm-asm/src/identifiers/string_shifters.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace internal::ident::string_shifters {
1212
shifter_id ls_mul_instruction(const sv mnemonic);
1313
shifter_id ls_coproc_instruction(const lexemes_t& lexemes);
1414
shifter_id vfp_mul_instruction(const lexemes_t& lexemes, const sv mnemonic);
15-
shifter_id usat_instruction(const lexemes_t& lexemes);
15+
shifter_id sat_instruction(const lexemes_t& lexemes);
1616

1717
// PLD has an exception to its addressing mode format
1818
shifter_id ls_instruction_PLD(const lexemes_t& lexemes);

0 commit comments

Comments
 (0)