This change doesn't seem to be tested. Does this belong in a separate patch?
A few questions:
nit: i don't know why gp is used here instead of Pg, which is used in the rest of file.
This makes sure that the bfloat case in the test file will work only if the +bf16 is added to the target feature. If I remove this, the bfloat case will lower even without the +bf16 target feature.
To properly test this, I shall create an llc test that fails with a when +bf16 is not listed as a target feature and that catches the "missing patters" debug message from the failure. I don't think we have tests like these, but let me know if this is something you want me to add one.
FWIW, this "early exit if lowering bfloat when not targeting bfloat" code is used also in other places, like performST1Combine. It is needed because we have encoded only integer patterns in the tablegen files, and we lower FP values by bitcasting them to integer values.
I don't know, but neither no added complexity or AddedComplexity = 1 work. In both cases, the reg+reg addressing mode specified in the multicalss sve_mem_ldor_ss wins. AddedComplexity = 2 is the first non-zero value that makes it work...
I made the class use $Pg. I guess I got $gp by copy-paste from other places (I can see few in this file).
Ah okay, so it is kind of tested, i.e. when removing the +bf16 attribute the test would now fail, where it didn't previously. I don't think a special negative test is needed though.
I think this should be cast, not static_cast.
Okay thanks for clarifying and fixing.
nit: odd indentation.