From d96ffd4a824958e85e5de51210a4a49b5251a7d5 Mon Sep 17 00:00:00 2001
From: Tri Vo <trong@google.com>
Date: Wed, 21 Sep 2016 15:10:38 -0700
Subject: [PATCH 02/20] x86/test_FISTTP: Compile breakpoints and x86 tests

Test: make vts
(cherry picked from commit 0fd3eaf312c6284450f758e3a49c5cfd855e4847)
---
 tools/testing/selftests/x86/test_FISTTP.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/tools/testing/selftests/x86/test_FISTTP.c b/tools/testing/selftests/x86/test_FISTTP.c
index 09789c0ce3e9..c920a57ddb06 100644
--- a/tools/testing/selftests/x86/test_FISTTP.c
+++ b/tools/testing/selftests/x86/test_FISTTP.c
@@ -25,7 +25,11 @@ int test(void)
 	feclearexcept(FE_DIVBYZERO|FE_INEXACT|FE_INVALID|FE_OVERFLOW|FE_UNDERFLOW);
 	asm volatile ("\n"
 	"	fld1""\n"
+#ifdef __clang__
+	"	fisttps	res16""\n"
+#else
 	"	fisttp	res16""\n"
+#endif
 	"	fld1""\n"
 	"	fisttpl	res32""\n"
 	"	fld1""\n"
@@ -45,7 +49,11 @@ int test(void)
 	feclearexcept(FE_DIVBYZERO|FE_INEXACT|FE_INVALID|FE_OVERFLOW|FE_UNDERFLOW);
 	asm volatile ("\n"
 	"	fldpi""\n"
+#ifdef __clang__
+	"	fisttps	res16""\n"
+#else
 	"	fisttp	res16""\n"
+#endif
 	"	fldpi""\n"
 	"	fisttpl	res32""\n"
 	"	fldpi""\n"
@@ -66,7 +74,13 @@ int test(void)
 	asm volatile ("\n"
 	"	fldpi""\n"
 	"	fchs""\n"
+#ifdef __clang__
+	"	fisttps	res16""\n"
+#else
+    // clang will complain: ambiguous instructions require an explicit suffix
+    // (could be 'fisttps', or 'fisttpl')
 	"	fisttp	res16""\n"
+#endif
 	"	fldpi""\n"
 	"	fchs""\n"
 	"	fisttpl	res32""\n"
@@ -88,7 +102,11 @@ int test(void)
 	feclearexcept(FE_DIVBYZERO|FE_INEXACT|FE_INVALID|FE_OVERFLOW|FE_UNDERFLOW);
 	asm volatile ("\n"
 	"	fldln2""\n"
+#ifdef __clang__
+	"	fisttps	res16""\n"
+#else
 	"	fisttp	res16""\n"
+#endif
 	"	fldln2""\n"
 	"	fisttpl	res32""\n"
 	"	fldln2""\n"
-- 
2.42.0.609.gbb76f46606-goog

