summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruros <uros@138bc75d-0d04-0410-961f-82ee72b054a4>2015-06-30 08:26:57 +0000
committeruros <uros@138bc75d-0d04-0410-961f-82ee72b054a4>2015-06-30 08:26:57 +0000
commit5ac78bd34de721a28af3daf2550c48ba94d9c537 (patch)
tree3e649d9c12df346a13be8355f1c9a4a10b867abe
parentb9d66f8d6f14445944c43c3e5410c5735f2d3b6a (diff)
downloadgcc-5ac78bd34de721a28af3daf2550c48ba94d9c537.tar.gz
* lex.c (search_line_sse42) [__GCC_ASM_FLAG_OUTPUTS__]: New main
loop using asm flag outputs. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@225160 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--libcpp/ChangeLog5
-rw-r--r--libcpp/lex.c28
2 files changed, 28 insertions, 5 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index f373dad5130..c7ac1e3aec0 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,8 @@
+2015-06-30 Uros Bizjak <ubizjak@gmail.com>
+
+ * lex.c (search_line_sse42) [__GCC_ASM_FLAG_OUTPUTS__]: New main
+ loop using asm flag outputs.
+
2015-06-08 Marek Polacek <polacek@redhat.com>
PR c/66415
diff --git a/libcpp/lex.c b/libcpp/lex.c
index c7296a110b6..5758e580c2b 100644
--- a/libcpp/lex.c
+++ b/libcpp/lex.c
@@ -450,15 +450,33 @@ search_line_sse42 (const uchar *s, const uchar *end)
s = (const uchar *)((si + 16) & -16);
}
- /* Main loop, processing 16 bytes at a time. By doing the whole loop
- in inline assembly, we can make proper use of the flags set. */
- __asm ( "sub $16, %1\n"
- " .balign 16\n"
+ /* Main loop, processing 16 bytes at a time. */
+#ifdef __GCC_ASM_FLAG_OUTPUTS__
+ while (1)
+ {
+ char f;
+
+ /* By using inline assembly instead of the builtin,
+ we can use the result, as well as the flags set. */
+ __asm ("%vpcmpestri\t$0, %2, %3"
+ : "=c"(index), "=@ccc"(f)
+ : "m"(*s), "x"(search), "a"(4), "d"(16));
+ if (f)
+ break;
+
+ s += 16;
+ }
+#else
+ s -= 16;
+ /* By doing the whole loop in inline assembly,
+ we can make proper use of the flags set. */
+ __asm ( ".balign 16\n"
"0: add $16, %1\n"
- " %vpcmpestri $0, (%1), %2\n"
+ " %vpcmpestri\t$0, (%1), %2\n"
" jnc 0b"
: "=&c"(index), "+r"(s)
: "x"(search), "a"(4), "d"(16));
+#endif
found:
return s + index;