[hjl@gnu-3 predicate]$ cat bar.i void prefetch (void *p, int s) { if (s) __builtin_prefetch (p, 1, 1); } [hjl@gnu-3 predicate]$ gcc -Wall -O bar.i -S [hjl@gnu-3 predicate]$ cat bar.s .pred.safe_across_calls p1-p5,p16-p63 .text .align 16 .global prefetch# .proc prefetch# prefetch: .prologue .body cmp4.eq p6, p7 = 0, r33 ;; lfetch.excl.nt1 [r32] br.ret.sptk.many rp ;; .endp prefetch# The problem is there is no (p7) before "lfetch.excl.nt1 [r32]". That means __builtin_prefetch (p, 1, 1); is always executed even if 's' is 0.
ISSUE TRACKER 26067 opened as sev 3
It is not a bug (at least with user's point of view). The code generated for -O1 is the same as for -02 (lprefetch is not predicated). HJ found that prefetch is predicated in RTL (when -O1) but the corresponding lprefetch insn is not predicated in assembler code therefore he reported about this. I think we should not make a patch (or use already created patch) for gcc especially on this stage. More information could be found in http://gcc.gnu.org/ml/gcc/2003-07/msg01655.html http://gcc.gnu.org/ml/gcc/2003-07/msg01657.html