> Hi Luis,

> On Tue, May 26, 2026 at 8:07 PM Luis Silva <[email protected]> wrote:
>>
>> The -mno-code-density flag was not working correctly on ARCv2 EM, causing
>> compact load/store instructions (ld_s, st_s, ldb_s, ldh_s, stb_s, sth_s) to
>> still be generated even when code density was explicitly disabled.

> AFAIK, there are ld_s/st_s instructions in the BASE_LINE. So it is ok
> to have short instructions in the code although you selected
> -mno-code-density as those one being part of the base line
> configuration.
> For example, the only LD instructions listed as code density are:

> LD_S R0,[h,u5]               01000U00hhhuu1HH
> LD_S R1,[h,u5]               01000U01hhhuu1HH
> LD_S R2,[h,u5]               01000U10hhhuu1HH
> LD_S R3,[h,u5]               01000U11hhhuu1HH
> LD_S.AS a,[b,c]              01001bbbccc00aaa
> LD_S R1,[GP,s11]           01010SSSSSS00sss

> Please provide a prof document if you think otherwise,
> Claudiu

Hi Claudiu,

Yes, you're right and this patch is incorrect.  Indeed there are baseline
variants which only the encoding changes rather than omitting the instruction
Itself.

The real problem comes from the assembler call from the gcc driver.  For ARC EM
CPUs that enable code density by default (such as em4_dmips), it was
unconditionally passing -mcode-density to the assembler even when the user
explicitly passed -mno-code-density to the driver.  This was causing the
assembler to emit code-density-specific encodings, which would trigger an 
illegal
instruction exception on cores with code density disabled.

I will be submitting a new patch addressing this.

Regards,
Luis

Reply via email to