Open arichardson opened 4 years ago
We are currently missing various folds that are performed for ADD/SUB.
This causes __builtin_align_down to generate the following:
daddiu $1, $zero, 1 dsubu $1, $1, $4 cjr $c17 candaddr $c3, $c3, $1
But it should instead use dnegu:
dnegu $1, $4 cjr $c17 candaddr $c3, $c3, $1
Note that these are not equivalent; the former is incorrect and was fixed in https://github.com/CTSRD-CHERI/llvm-project/commit/3bcce7d22ed378994612b7bbe1a48ceefe6145db, which gives the latter. We still don't have nice folds for p + (q - p)
-like constructs on non-MIPS to be set address operations, though, which is the pattern generated by __builtin_align_up.
We are currently missing various folds that are performed for ADD/SUB.
This causes __builtin_align_down to generate the following:
But it should instead use dnegu:
Similarly align_up is also inefficient: