>> Since GCC 4.9 (including current mainline), it generates optimal >> >> code with no mov instructions, matching what used to be generated >> >> in GCC 4.1. >> >> >> >> foo: rdtsc >> >> sal rdx, 32 >> >> or rax, rdx >> >> ret >> >> >> >> This test case, which has been tested on x86_64-pc-linux-gnu, >> >> simply checks that we don't regress again in future. >> >> Ok for mainline? > > I think you need to restrict this to lp64, at least it fails for me with -m32. > It also passes with -mx32 but not sure how the perfect target selector > would look like.
/* { dg-do compile { target { ! ia32 } } } */ should do the trick. > Otherwise looks OK. +/* { dg-final { scan-assembler-not "mov" } } */ This test is maybe too fragile, some targets generate frame setup instructions, e.g.: movl %esp, %ebp that will trigger the FAIL. If there are false positives, we can add a target selector for *-*-linux to scan-assembler-not. Uros.