value = 9;
if (value)
- alt_cost = 2 + riscv_build_integer_1 (alt_codes,
+ alt_cost = 3 + riscv_build_integer_1 (alt_codes,
sext_hwi (loval, 32), mode);
/* For constants where the upper half is a shNadd of the lower half
we can do a similar transformation. */
if (value && alt_cost < cost)
{
- alt_codes[alt_cost - 3].save_temporary = true;
- alt_codes[alt_cost - 2].code = FMA;
- alt_codes[alt_cost - 2].value = value;
+ alt_codes[alt_cost - 4].save_temporary = true;
+ alt_codes[alt_cost - 3].code = FMA;
+ alt_codes[alt_cost - 3].value = value;
+ alt_codes[alt_cost - 3].use_uw = false;
+ alt_codes[alt_cost - 3].save_temporary = false;
+ alt_codes[alt_cost - 2].code = ASHIFT;
+ alt_codes[alt_cost - 2].value = 32;
alt_codes[alt_cost - 2].use_uw = false;
alt_codes[alt_cost - 2].save_temporary = false;
alt_codes[alt_cost - 1].code = CONCAT;
--- /dev/null
+/* { dg-do run { target { riscv64*-*-* } } } */
+/* { dg-options "-march=rv64gc_zba_zbb -mabi=lp64d" } */
+
+#define myconst 0x4fffaffb0fffefffUL;
+volatile unsigned long a = myconst;
+unsigned long foo()
+{
+ return myconst;
+}
+
+int main()
+{
+ if (foo() != a)
+ __builtin_abort();
+ __builtin_exit (0);
+}
total number of instructions.
This isn't expected to change much and any change is worthy of a look. */
-/* { dg-final { scan-assembler-times "\\t(add|addi|bseti|li|pack|ret|sh1add|sh2add|sh3add|slli|srli|xori|or)" 45 } } */
+/* { dg-final { scan-assembler-times "\\t(add|addi|bseti|li|pack|ret|sh1add|sh2add|sh3add|slli|srli|xori|or)" 54 } } */
unsigned long foo_0x7907d89a2857f2de(void) { return 0x7907d89a2857f2deUL; }