GCC is no longer passing the "-many" flag to the assembler. So, the
inline assembly instructions statements need to use the .machine directives
for the specific platform.
(gcc commit
e154242724b084380e3221df7c08fcdbd8460674 ; "[RS6000] Don't
pass -many to the assembler".
Hardware sync instruction (hwsync) added after the copy, paste and cpabort
instructions to improve the reliability of the test.
# Power ISA flag for use by guest_ppc_helpers.c
if HAS_XSCVHPDP
if HAS_DARN
-ISA_3_0_BUILD_FLAG = -DHAS_XSCVHPDP -DHAS_DARN
+ISA_3_0_BUILD_FLAG = -DHAS_XSCVHPDP -DHAS_DARN -DHAS_ISA_3_00
else
-ISA_3_0_BUILD_FLAG = -DHAS_XSCVHPDP
+ISA_3_0_BUILD_FLAG = -DHAS_XSCVHPDP -DHAS_ISA_3_00
endif
else
ISA_3_0_BUILD_FLAG =
UInt cr;
if (op == COPY_INST)
- __asm__ __volatile__ ("copy 0,%0" :: "r" (addr));
+ __asm__ __volatile__ (".machine push;\n"
+ ".machine power9;\n"
+ "copy 0,%0;\n"
+ ".machine pop" :: "r" (addr));
else if (op == PASTE_INST)
- __asm__ __volatile__ ("paste. 0,%0" :: "r" (addr));
+ __asm__ __volatile__ (".machine push;\n"
+ ".machine power9;\n"
+ "paste. 0,%0\n"
+ ".machine pop" :: "r" (addr));
else if (op == CPABORT_INST)
- __asm__ __volatile__ ("cpabort");
+ __asm__ __volatile__ (".machine push;\n"
+ ".machine power9;\n"
+ "cpabort\n"
+ ".machine pop");
else
/* Unknown operation */
" ld 4, 16(3)\n" /* sc arg 2 */
" ld 0, 0(3)\n" /* sc number */
" ld 3, 8(3)\n" /* sc arg 1 */
+
+" .machine push\n"
+" .machine \"power9\"\n"
" scv 0\n"
+" .machine pop\n"
" ld 5,-16(1)\n" /* reacquire argblock ptr (r5 is caller-save) */
" std 3,0(5)\n" /* argblock[0] = r3 */
subnormal_test_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -g -mregnames $(VSX_FLAG) $(ISA_2_06_FLAG) \
@FLAG_M64@ $(ALTIVEC_FLAG) $(BUILD_FLAG_VSX) $(BUILD_FLAGS_ISA_2_06)
-test_copy_paste_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -g -mregnames $(HTM_FLAG) $(ISA_3_00_FLAG) \
- @FLAG_M64@ $(BUILD_FLAGS_ISA_3_00)
+test_copy_paste_CFLAGS = $(AM_CFLAGS) -Winline -Wall -O -g -mregnames $(HTM_FLAG) $(ISA_3_1_FLAG) \
+ @FLAG_M64@ $(BUILD_FLAGS_ISA_3_1)
test_isa_2_06_part3_LDADD = -lm
test_dfp1_LDADD = -lm
/* The copy, paste, cpabort are ISA 3.0 instructions. However, the memory
- to memory copy is only supported on ISA 3.1 era machines. */
+ to memory copy is only supported on ISA 3.1 era machines.
+
+ The following test does a memory to memory copy test, an out of order
+ paste test, and a copy paste abort test. This test is only supported
+ ISA 3.1 systems. */
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <malloc.h>
-#ifdef HAS_ISA_3_00
+#ifdef HAS_ISA_3_1
#include <altivec.h>
/* return CR0 in least significant bits */
void test_copy (uint8_t *reg)
{
- __asm__ __volatile__ ("copy 0,%0" : : "r" (reg));
+ __asm__ __volatile__ (".machine push; .machine power9; " \
+ "copy 0,%0; hwsync; .machine pop;" : : "r" (reg));
}
void test_paste (uint8_t *reg)
{
- __asm__ __volatile__ ("paste. 0,%0" : : "r" (reg));
+ __asm__ __volatile__ (".machine push; .machine power9; " \
+ "paste. 0,%0; hwsync; .machine pop;" : : "r" (reg));
}
void test_cpabort (void)
{
- __asm__ __volatile__ ("cpabort");
+ __asm__ __volatile__ (".machine push; .machine power9; " \
+ "cpabort; hwsync; .machine pop;");
}
#define NUM_ELEMENTS 128
int main()
{
-#ifdef HAS_ISA_3_00
+#ifdef HAS_ISA_3_1
int i;
unsigned int cc_value;
int result = SUCCESS;
test_paste (dst_buffer);
GET_CR0(cc_value);
+#if DEBUG
+ printf("CR0 = 0x%x\n", cc_value);
+#endif
+
#if DEBUG
printf("AFTER COPY/PASTE Contents of src/dst buffer\n");
for (i=0; i<NUM_ELEMENTS; i++) {
printf("FAILURE.\n");
#else
- printf("HAS_ISA_3_00 not detected.\n");
+ printf("HAS_ISA_3_1 not detected.\n");
#endif
return 0;
}