5c5d2c
commit cbca67dae5722d65590e33b8b885a561ac3fff5d
5c5d2c
Author: William Cohen <wcohen@redhat.com>
5c5d2c
Date:   Tue Jun 15 21:48:15 2021 -0400
5c5d2c
5c5d2c
    Use numeric local labels to allow compilation with LTO enabled
5c5d2c
    
5c5d2c
    Some assembly snippets in instructions_testcode.c used regular label
5c5d2c
    names.  Unfortunately, when multiple copies of the snippets are
5c5d2c
    inlined in different places with LTO enabled the multiple copies of a
5c5d2c
    label by the same name cause the build to fail because of the
5c5d2c
    redefinition of the label.  To avoid this problem all those labels
5c5d2c
    have been converted to numeric local labels to allow multiple copies
5c5d2c
    to peacefully coexist in the LTO enabled code.
5c5d2c
5c5d2c
diff --git a/src/validation_tests/instructions_testcode.c b/src/validation_tests/instructions_testcode.c
5c5d2c
index 3634b1f90..128127c25 100644
5c5d2c
--- a/src/validation_tests/instructions_testcode.c
5c5d2c
+++ b/src/validation_tests/instructions_testcode.c
5c5d2c
@@ -10,9 +10,9 @@ int instructions_million(void) {
5c5d2c
 #if defined(__i386__) || (defined __x86_64__)
5c5d2c
 	asm(	"	xor	%%ecx,%%ecx\n"
5c5d2c
 		"	mov	$499999,%%ecx\n"
5c5d2c
-		"test_loop:\n"
5c5d2c
+		"55:\n"
5c5d2c
 		"	dec	%%ecx\n"
5c5d2c
-		"	jnz	test_loop\n"
5c5d2c
+		"	jnz	55b\n"
5c5d2c
 		: /* no output registers */
5c5d2c
 		: /* no inputs */
5c5d2c
 		: "cc", "%ecx" /* clobbered */
5c5d2c
@@ -47,9 +47,9 @@ int instructions_million(void) {
5c5d2c
 #elif defined(__sparc__)
5c5d2c
 	asm(	"	sethi	%%hi(333333), %%l0\n"
5c5d2c
 		"	or	%%l0,%%lo(333333),%%l0\n"
5c5d2c
-		"test_loop:\n"
5c5d2c
+		"55:\n"
5c5d2c
 		"	deccc	%%l0		! decrement count\n"
5c5d2c
-		"	bnz	test_loop	! repeat until zero\n"
5c5d2c
+		"	bnz	55b		! repeat until zero\n"
5c5d2c
 		"	nop			! branch delay slot\n"
5c5d2c
 		: /* no output registers */
5c5d2c
 		: /* no inputs */
5c5d2c
@@ -57,13 +57,13 @@ int instructions_million(void) {
5c5d2c
 	);
5c5d2c
 	return 0;
5c5d2c
 #elif defined(__arm__)
5c5d2c
-	asm(	"	ldr	r2,count	@ set count\n"
5c5d2c
-		"	b       test_loop\n"
5c5d2c
-		"count:	.word 333332\n"
5c5d2c
-		"test_loop:\n"
5c5d2c
+	asm(	"	ldr	r2,42f		@ set count\n"
5c5d2c
+		"	b       55f\n"
5c5d2c
+		"42:	.word 333332\n"
5c5d2c
+		"55:\n"
5c5d2c
 		"	add	r2,r2,#-1\n"
5c5d2c
 		"	cmp	r2,#0\n"
5c5d2c
-		"	bne	test_loop	@ repeat till zero\n"
5c5d2c
+		"	bne	55b		@ repeat till zero\n"
5c5d2c
 		: /* no output registers */
5c5d2c
 		: /* no inputs */
5c5d2c
 		: "cc", "r2" /* clobbered */
5c5d2c
@@ -71,10 +71,10 @@ int instructions_million(void) {
5c5d2c
 	return 0;
5c5d2c
 #elif defined(__aarch64__)
5c5d2c
 	asm(	"	ldr	x2,=333332	// set count\n"
5c5d2c
-		"test_loop:\n"
5c5d2c
+		"55:\n"
5c5d2c
 		"	add	x2,x2,#-1\n"
5c5d2c
 		"	cmp	x2,#0\n"
5c5d2c
-		"	bne	test_loop	// repeat till zero\n"
5c5d2c
+		"	bne	55b		// repeat till zero\n"
5c5d2c
 		: /* no output registers */
5c5d2c
 		: /* no inputs */
5c5d2c
 		: "cc", "r2" /* clobbered */
5c5d2c
@@ -97,7 +97,7 @@ int instructions_fldcw(void) {
5c5d2c
 	double three=3.0;
5c5d2c
 
5c5d2c
 	asm(	"	mov	$100000,%%ecx\n"
5c5d2c
-		"big_loop:\n"
5c5d2c
+		"44:\n"
5c5d2c
 		"	fldl	%1		# load value onto fp stack\n"
5c5d2c
 		"	fnstcw	%0		# store control word to mem\n"
5c5d2c
 		"	movzwl	%0, %%eax	# load cw from mem, zero extending\n"
5c5d2c
@@ -106,7 +106,7 @@ int instructions_fldcw(void) {
5c5d2c
 		"	fldcw	%3		# save new rounding mode\n"
5c5d2c
 		"	fistpl	%2		# save stack value as integer to mem\n"
5c5d2c
 		"	fldcw	%0		# restore old cw\n"
5c5d2c
-		"	loop	big_loop	# loop to make the count more obvious\n"
5c5d2c
+		"	loop	44b		# loop to make the count more obvious\n"
5c5d2c
 		: /* no output registers */
5c5d2c
 		: "m"(saved_cw), "m"(three), "m"(result), "m"(cw) /* inputs */
5c5d2c
 		: "cc", "%ecx","%eax" /* clobbered */
5c5d2c
@@ -129,13 +129,13 @@ int instructions_rep(void) {
5c5d2c
 
5c5d2c
 	asm(	"	mov	$1000,%%edx\n"
5c5d2c
 		"	cld\n"
5c5d2c
-		"loadstore:			# test 8-bit store\n"
5c5d2c
+		"66:				# test 8-bit store\n"
5c5d2c
 		"	mov	$0xd, %%al	# set eax to d\n"
5c5d2c
 		"	mov	$16384, %%ecx\n"
5c5d2c
 		"	mov	%0, %%edi	# set destination\n"
5c5d2c
 		"	rep	stosb		# store d 16384 times, auto-increment\n"
5c5d2c
 		"	dec	%%edx\n"
5c5d2c
-		"	jnz	loadstore\n"
5c5d2c
+		"	jnz	66b\n"
5c5d2c
 		: /* outputs */
5c5d2c
 		: "rm" (buffer_out) /* inputs */
5c5d2c
 		: "cc", "%esi","%edi","%edx","%ecx","%eax","memory" /* clobbered */
5c5d2c
@@ -147,13 +147,13 @@ int instructions_rep(void) {
5c5d2c
 
5c5d2c
 	asm(	"	mov	$1000,%%edx\n"
5c5d2c
 		"	cld\n"
5c5d2c
-		"loadstore:			# test 8-bit store\n"
5c5d2c
+		"66:				# test 8-bit store\n"
5c5d2c
 		"	mov	$0xd, %%al	# set eax to d\n"
5c5d2c
 		"	mov	$16384, %%ecx\n"
5c5d2c
 		"	mov	%0, %%rdi	# set destination\n"
5c5d2c
 		"	rep	stosb		# store d 16384 times, auto-increment\n"
5c5d2c
 		"	dec	%%edx\n"
5c5d2c
-		"	jnz	loadstore\n"
5c5d2c
+		"	jnz	66b\n"
5c5d2c
 		: /* outputs */
5c5d2c
 		: "rm" (buffer_out) /* inputs */
5c5d2c
 		: "cc", "%esi","%edi","%edx","%ecx","%eax","memory" /* clobbered */