https://gcc.gnu.org/g:82bccaca92843f0a823d5490d5764de69c291e6e
commit r17-1940-g82bccaca92843f0a823d5490d5764de69c291e6e Author: Oleg Endo <[email protected]> Date: Sun Jun 28 18:07:45 2026 +0900 SH: Add reduced test case from PR55212 c#464 / att. 62360 gcc/testsuite/ChangeLog: PR target/55212 * gcc.target/sh/torture/pr55212-c464-1.c: New. * gcc.target/sh/torture/pr55212-c464-2.c: New. Diff: --- .../gcc.target/sh/torture/pr55212-c464-1.c | 43 ++++++++++++++++++++++ .../gcc.target/sh/torture/pr55212-c464-2.c | 37 +++++++++++++++++++ 2 files changed, 80 insertions(+) diff --git a/gcc/testsuite/gcc.target/sh/torture/pr55212-c464-1.c b/gcc/testsuite/gcc.target/sh/torture/pr55212-c464-1.c new file mode 100644 index 000000000000..d8b11c1df7b3 --- /dev/null +++ b/gcc/testsuite/gcc.target/sh/torture/pr55212-c464-1.c @@ -0,0 +1,43 @@ +/* { dg-additional-options "-std=c23 -m4 -mfsca -ffast-math" } */ +/* { dg-do compile } */ + +typedef float vec3[3]; +typedef float vec4[4]; +typedef vec4 mat4[4]; + +float glm_rotate_make_angle, glm_rotate_make___trans_tmp_1, glm_rotate_at_m_2_1, + glm_rotate_at_m_1_1, glm_rotate_at_m_0_0, glm_rotate_at_m_0_3, + glm_rotate_at_m_2_3, glm_rotate_at_pivot; +vec3 glm_rotate_make_vs; + +vec4 *glm_rotate_at_m; + +inline void glm_rotate_make (mat4 m) +{ + float vs_2; + glm_rotate_make___trans_tmp_1 = __builtin_sinf (glm_rotate_make_angle); + float *dest = glm_rotate_make_vs; + dest[0] = glm_rotate_make___trans_tmp_1; + m[0][2] -= vs_2 += glm_rotate_make_vs[0]; +} + +void glmc_rotate_at (void) +{ + __attribute((aligned(8))) vec3 pivotInv; + float *v = &glm_rotate_at_pivot, *dest = glm_rotate_at_m[3]; + dest[3] += glm_rotate_at_m[1][3] * v[1]; + dest[3] += glm_rotate_at_m_2_3 * v[2]; + { + __attribute((aligned(16))) mat4 rot; + glm_rotate_make(rot); + vec4 *dest = glm_rotate_at_m; + float a03 = glm_rotate_at_m_0_3, b10 = rot[1][0], b11 = rot[1][1]; + dest[0][1] = glm_rotate_at_m_0_0 + glm_rotate_at_m_1_1 * rot[0][1] + + glm_rotate_at_m_2_1 * rot[0][2]; + dest[1][3] = a03 * b10 * b11; + } + { + dest[3] += glm_rotate_at_m_1_1; + dest[3] += pivotInv[2]; + } +} diff --git a/gcc/testsuite/gcc.target/sh/torture/pr55212-c464-2.c b/gcc/testsuite/gcc.target/sh/torture/pr55212-c464-2.c new file mode 100644 index 000000000000..6f21006d72ae --- /dev/null +++ b/gcc/testsuite/gcc.target/sh/torture/pr55212-c464-2.c @@ -0,0 +1,37 @@ +/* { dg-additional-options "-std=c23 -m4 -mfsca -ffast-math" } */ +/* { dg-do compile } */ + + +typedef float vec4[4]; +typedef vec4 mat4[4]; +float glm_mul_rot_m1_2_2, glm_mul_rot_m1_1_2, glm_mul_rot_m1_0_2, + glm_mul_rot_m1_3_3, glm_mul_rot_m1_3_2, glm_mul_rot_m1_3_1, + glm_mul_rot_m1_3_0, glm_mul_rot_m1_2_1, glm_mul_rot_m1_2_0, + glm_mul_rot_dest_3_3, glm_mul_rot_dest_3_2, glm_mul_rot_dest_3_1, + glm_mul_rot_dest_3_0, glm_mul_rot_dest_2_3, glm_mul_rot_dest_1_2, + glm_mul_rot_dest_1_1, glm_mul_rot_dest_1_0, glm_mul_rot_dest_0_2, + glm_rotate_z_angle; + +static void glm_mul_rot(mat4 m2) { + float a20 = glm_mul_rot_m1_2_0, a21 = glm_mul_rot_m1_2_1, + a30 = glm_mul_rot_m1_3_0, a31 = glm_mul_rot_m1_3_1, + a32 = glm_mul_rot_m1_3_2, a33 = glm_mul_rot_m1_3_3, b11 = m2[1][1], + b20 = m2[2][0], b21 = m2[2][1], b22 = m2[2][2]; + glm_mul_rot_dest_0_2 = glm_mul_rot_m1_0_2 * m2[0][0] + + glm_mul_rot_m1_1_2 * m2[0][1] + + glm_mul_rot_m1_2_2 * m2[0][2]; + glm_mul_rot_dest_1_0 = a20; + glm_mul_rot_dest_1_1 = a21; + glm_mul_rot_dest_1_2 = b11; + glm_mul_rot_dest_2_3 = b20 * b21 * b22; + glm_mul_rot_dest_3_0 = a30; + glm_mul_rot_dest_3_1 = a31; + glm_mul_rot_dest_3_2 = a32; + glm_mul_rot_dest_3_3 = a33; +} +void glmc_rotate_z() { + mat4 t; + float s = __builtin_sinf(glm_rotate_z_angle); + t[0][1] = s; + glm_mul_rot(t); +} \ No newline at end of file
