> diff --git a/gcc/config/riscv/thead.cc b/gcc/config/riscv/thead.cc
> index de23e410d4c..b78e2762cfa 100644
> --- a/gcc/config/riscv/thead.cc
> +++ b/gcc/config/riscv/thead.cc
> @@ -1059,12 +1059,17 @@ th_asm_output_opcode (FILE *asm_out_file, const char
> *p)
> get_attr_type (current_output_insn) == TYPE_VSSEGTE
> ? fputs ("th.vsseg", asm_out_file)
> : fputs ("th.vlseg", asm_out_file);
> - asm_fprintf (asm_out_file, "%c", p[5]);
> - fputs ("e", asm_out_file);
> - if (strstr (p, "e8"))
> - return p+8;
> - else
> - return p+9;
> + if (strstr (p, "b") || strstr (p, "h") || strstr (p, "w"))
> + return p+5;
> + else
> + {
> + asm_fprintf (asm_out_file, "%c", p[5]);
> + fputs ("e", asm_out_file);
> + if (strstr (p, "e8"))
> + return p+8;
> + else
> + return p+9;
> + }
indentation seems wrong for this file.
> }
>
> if (get_attr_type (current_output_insn) == TYPE_VLSEGDS ||
> @@ -1073,36 +1078,51 @@ th_asm_output_opcode (FILE *asm_out_file, const char
> *p)
> get_attr_type (current_output_insn) == TYPE_VSSEGTS
> ? fputs ("th.vssseg", asm_out_file)
> : fputs ("th.vlsseg", asm_out_file);
> - asm_fprintf (asm_out_file, "%c", p[6]);
> - fputs ("e", asm_out_file);
> - if (strstr (p, "e8"))
> - return p+9;
> - else
> - return p+10;
> + if (strstr (p, "b") || strstr (p, "h") || strstr (p, "w"))
> + return p+6;
> + else
> + {
> + asm_fprintf (asm_out_file, "%c", p[6]);
> + fputs ("e", asm_out_file);
> + if (strstr (p, "e8"))
> + return p+9;
> + else
> + return p+10;
> + }
> }
>
> if (get_attr_type (current_output_insn) == TYPE_VLSEGDUX ||
> get_attr_type (current_output_insn) == TYPE_VLSEGDOX)
> {
> fputs ("th.vlxseg", asm_out_file);
> - asm_fprintf (asm_out_file, "%c", p[7]);
> - fputs ("e", asm_out_file);
> - if (strstr (p, "ei8"))
> - return p+11;
> - else
> - return p+12;
> + if (strstr (p, "b") || strstr (p, "h") || strstr (p, "w"))
> + return p+6;
> + else
> + {
> + asm_fprintf (asm_out_file, "%c", p[7]);
> + fputs ("e", asm_out_file);
> + if (strstr (p, "ei8"))
> + return p+11;
> + else
> + return p+12;
> + }
> }
>
> if (get_attr_type (current_output_insn) == TYPE_VSSEGTUX ||
> get_attr_type (current_output_insn) == TYPE_VSSEGTOX)
> {
> fputs ("th.vsxseg", asm_out_file);
> - asm_fprintf (asm_out_file, "%c", p[7]);
> - fputs ("e", asm_out_file);
> - if (strstr (p, "ei8"))
> - return p+11;
> - else
> - return p+12;
> + if (strstr (p, "b") || strstr (p, "h") || strstr (p, "w"))
> + return p+6;
> + else
> + {
> + asm_fprintf (asm_out_file, "%c", p[7]);
> + fputs ("e", asm_out_file);
> + if (strstr (p, "ei8"))
> + return p+11;
> + else
> + return p+12;
> + }
> }
>
> if (get_attr_type (current_output_insn) == TYPE_VNSHIFT)