Skip to content

Commit

Permalink
Allow faking access to any EVEX encoded SSE register
Browse files Browse the repository at this point in the history
This leads to significantly better code-gen on benchmarks that need many
registers.

ChangeLog:

	* vir/simd_benchmarking.h (fake_modify_one, fake_read_one):
	Prefer v over x in constraints.
  • Loading branch information
mattkretz committed Apr 18, 2023
1 parent e921ee2 commit 2483188
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions vir/simd_benchmarking.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace vir
fake_modify_one(T& x)
{
if constexpr (std::is_floating_point_v<T>)
asm volatile("" : "+x"(x));
asm volatile("" : "+v,x"(x));
else if constexpr (stdx::is_simd_v<T> || stdx::is_simd_mask_v<T>)
{
#if defined _GLIBCXX_EXPERIMENTAL_SIMD && __cpp_lib_experimental_parallel_simd >= 201803
Expand All @@ -36,11 +36,11 @@ namespace vir
if constexpr (sizeof(x) < 16)
asm volatile("" : "+g"(x));
else
asm volatile("" : "+x,g,m"(x));
asm volatile("" : "+v,x,g,m"(x));
#endif
}
else if constexpr (sizeof(x) >= 16)
asm volatile("" : "+x"(x));
asm volatile("" : "+v,x"(x));
else
asm volatile("" : "+g"(x));
}
Expand All @@ -55,7 +55,7 @@ namespace vir
fake_read_one(const T& x)
{
if constexpr (std::is_floating_point_v<T>)
asm volatile("" ::"x"(x));
asm volatile("" ::"v,x"(x));
else if constexpr (stdx::is_simd_v<T> || stdx::is_simd_mask_v<T>)
{
#if defined _GLIBCXX_EXPERIMENTAL_SIMD && __cpp_lib_experimental_parallel_simd >= 201803
Expand All @@ -73,11 +73,11 @@ namespace vir
if constexpr (sizeof(x) < 16)
asm volatile("" ::"g"(x));
else
asm volatile("" ::"x,g,m"(x));
asm volatile("" ::"v,x,g,m"(x));
#endif
}
else if constexpr (sizeof(x) >= 16)
asm volatile("" ::"x"(x));
asm volatile("" ::"v,x"(x));
else
asm volatile("" ::"g"(x));
}
Expand Down

0 comments on commit 2483188

Please sign in to comment.