/* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ /* { dg-options "-mzarch -mhotpatch=1,2" } */ #include <stdio.h> __attribute__ ((hotpatch(0,0))) void hp1(void) { printf("hello, world!\n"); } /* Check number of occurences of certain instructions. */ /* { dg-final { scan-assembler-not "pre-label NOPs" } } */ /* { dg-final { scan-assembler-not "post-label NOPs" } } */ /* { dg-final { scan-assembler-not "nopr\t%r7" } } */ /* { dg-final { scan-assembler-not "nop\t0" } } */ /* { dg-final { scan-assembler-not "brcl\t0, 0" } } */ /* { dg-final { scan-assembler-not "alignment for hotpatch" } } */
/* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ /* { dg-options "-O3 -mzarch -mhotpatch=0,0 --save-temps" } */ #include <stdio.h> __attribute__ ((hotpatch(1,2))) void hp1(void) { printf("hello, world!\n"); } /* Check number of occurences of certain instructions. */ /* { dg-final { scan-assembler-times "nopr\t%r7" 1 } } */ /* { dg-final { scan-assembler-times "nop\t0" 1 } } */ /* { dg-final { scan-assembler-not "brcl\t\t0,0" } } */
} __attribute__ ((hotpatch)) inline void hp2(void) { printf("hello, world!\n"); } __attribute__ ((hotpatch)) __attribute__ ((always_inline)) void hp3(void) /* { dg-warning "always_inline function might not be inlinable" } */ { printf("hello, world!\n"); } /* { dg-warning "function 'hp3' with the 'always_inline' attribute is not hotpatchable" } */ __attribute__ ((hotpatch(0))) void hp4(void) { printf("hello, world!\n"); } __attribute__ ((hotpatch(0))) inline void hp5(void) { printf("hello, world!\n"); } __attribute__ ((hotpatch(0))) __attribute__ ((always_inline)) void hp6(void) /* { dg-warning "always_inline function might not be inlinable" } */ {