Hi Alice,

> We can't use the cntd instruction in non-streaming mode if SVE is not
> available, so instead use __arm_get_current_vg to get the value for the
> VG save slot.  This is more expensive, so continue using cntd if we know we're
> in streaming mode or have +sve enabled.

This is OK, but check the comment below.

Cheers,
Wilco


+(define_insn "aarch64_get_current_vg"
+  [(set (reg:DI R0_REGNUM)
+       (unspec_volatile:DI [(const_int 0)] UNSPEC_GET_CURRENT_VG))
+   (clobber (reg:DI R16_REGNUM))
+   (clobber (reg:DI R17_REGNUM))
+   (clobber (reg:DI R18_REGNUM))

Eh, where does that come from? We should not use or corrupt the
platform register without good reason. It looks like none of the SME
helpers actually use it, but still emit a clobber. This should be harmless
by default, however there are features that use this register, so the
correct approach is preserving it (by not using or clobbering it).

+   (clobber (reg:DI R30_REGNUM))
+   (clobber (reg:CC CC_REGNUM))]
+  ""
+  "bl\t__arm_get_current_vg"
+  [(set_attr "is_call" "yes")]
+)

Reply via email to