Path: news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: anton@mips.complang.tuwien.ac.at (Anton Ertl) Newsgroups: comp.arch Subject: Re: auto predicating branches Date: Wed, 23 Apr 2025 18:09:28 GMT Organization: Institut fuer Computersprachen, Technische Universitaet Wien Lines: 14 Message-ID: <2025Apr23.200928@mips.complang.tuwien.ac.at> References: <2025Apr21.080532@mips.complang.tuwien.ac.at> <2025Apr22.071010@mips.complang.tuwien.ac.at> <2025Apr22.193103@mips.complang.tuwien.ac.at> Injection-Date: Wed, 23 Apr 2025 20:11:40 +0200 (CEST) Injection-Info: dont-email.me; posting-host="65d91472a7cddc6d4f9bae1a9a480ab9"; logging-data="3782457"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18bI3oXWmwcjNYGYl3YjrTv" Cancel-Lock: sha1:0joq6Z9qAz8hy8mQNGaqiaAoFhM= X-newsreader: xrn 10.11 Stefan Monnier writes: >Of course, nothing prevents a CPU from doing "predicate prediction": >instead of waiting for an answer to `needle < *base[middle]`, it could >try and guess whether it will be true or false and thus choose to send >one of the two addresses (or both) to the memory (and later check the >prediction and rollback, just like we do with normal branches). That would subvert the use of predication for getting constant-time code for avoiding timing side channels. I.e., not a good idea. - anton -- 'Anyone trying for "industrial quality" ISA should avoid undefined behavior.' Mitch Alsup,