On Thu, Jan 4, 2018 at 2:58 PM, Richard Earnshaw <richard.earns...@arm.com> wrote: > > This patch implements support for __builtin_load_no_speculate on > AArch64. On this architecture we inhibit speclation by emitting a > combination of CSEL and a hint instruction that ensures the CSEL is > full resolved when the operands to the CSEL may involve a speculative > load.
Missing a high-level exlanation here but it looks like you do sth like if (access is not in bounds) no-speculate-access; else regular access; with the upper/lower bounds. Is this because 'no-speculate-access' is prohibitely expensive even when factoring in the condition computation and the condjump? (trying to reverse engineer how the actual assembly will look like from the patch, there isn't even a testcase :/) > * config/aarch64/aarch64.c (aarch64_print_operand): Handle zero passed > to 'H' operand qualifier. > (aarch64_inhibit_load_speculation): New function. > (TARGET_INHIBIT_LOAD_SPECULATION): Redefine. > * config/aarch64/aarch64.md (UNSPECV_NOSPECULATE): New unspec_volatile > code. > (nospeculate<ALLI:mode>, nospeculateti): New patterns. > --- > gcc/config/aarch64/aarch64.c | 92 > +++++++++++++++++++++++++++++++++++++++++++ > gcc/config/aarch64/aarch64.md | 28 +++++++++++++ > 2 files changed, 120 insertions(+) >