Yes. I agree. I didn't take a look into SPEC. Not sure whether fcsr has immediate form.
I mean this patch change in 'fcsr' is quite confusing. You should either fix the assembly code-gen if fcsr has immediate form, or fix predicate and constraint both (should not fix constraint only). Thanks. juzhe.zh...@rivai.ai From: Kito Cheng Date: 2023-07-26 11:45 To: juzhe.zh...@rivai.ai CC: jinma; gcc-patches; jeffreyalaw; palmer; richard.sandiford; philipp.tomsich; christoph.muellner; Robin Dapp; jinma.contrib Subject: Re: Re: [PATCH v3] RISC-V: Fixbug for fsflags instruction error using immediate. So I guess you should change `fscsr` to `fscsr%i0` instead of dropping K from the constraint list? On Wed, Jul 26, 2023 at 11:42 AM juzhe.zh...@rivai.ai <juzhe.zh...@rivai.ai> wrote: > > I don't understand: > (define_insn "riscv_fscsr" > - [(unspec_volatile [(match_operand:SI 0 "csr_operand" "rK")] UNSPECV_FSCSR)] > + [(unspec_volatile [(match_operand:SI 0 "csr_operand" "r")] UNSPECV_FSCSR)] > "TARGET_HARD_FLOAT || TARGET_ZFINX" > "fscsr\t%0") > > This pattern never allows immediate in the constraint. Why still make > predicate allow immediate? > > > > > juzhe.zh...@rivai.ai > > From: Jin Ma > Date: 2023-07-26 11:33 > To: gcc-patches; juzhe.zh...@rivai.ai > CC: jeffreyalaw; palmer; richard.sandiford; kito.cheng; philipp.tomsich; > christoph.muellner; Robin Dapp; jinma.contrib > Subject: Re: [PATCH v3] RISC-V: Fixbug for fsflags instruction error using > immediate. > > - [(unspec_volatile [(match_operand:SI 0 "csr_operand" "rK")] > > UNSPECV_FSCSR)] > > + [(unspec_volatile [(match_operand:SI 0 "csr_operand" "r")] > > UNSPECV_FSCSR)] > > > > If you don't allow immediate value in range 0 ~ 31, it should be > > "register_operand" instead of "csr_operand". > > > > > > I think directives that support the immediate pattern might be better, on the > one > hand fsflagsi are supported in the manual, on the other hand fsflagsi can be > slightly faster than fsflags. > > Regards > Jin > > > > > juzhe.zh...@rivai.ai > >