Skip to content

SPARC: Add gnu run line to sincos test #147714

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: users/arsenm/sparc/start-moving-runtime-libcalls-tablegen
Choose a base branch
from

Conversation

arsenm
Copy link
Contributor

@arsenm arsenm commented Jul 9, 2025

Make sure we have tests that emit the sincos call instead of
the separate sin and cos.

Copy link
Contributor Author

arsenm commented Jul 9, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@arsenm arsenm force-pushed the users/arsenm/sparc/add-gnu-runline-sincos branch from 95dd368 to d36e026 Compare July 9, 2025 12:57
@arsenm arsenm requested review from jyknight and koachan July 9, 2025 12:58
@arsenm arsenm marked this pull request as ready for review July 9, 2025 12:58
@llvmbot
Copy link
Member

llvmbot commented Jul 9, 2025

@llvm/pr-subscribers-backend-sparc

Author: Matt Arsenault (arsenm)

Changes

Make sure we have tests that emit the sincos call instead of
the separate sin and cos.


Full diff: https://github.com/llvm/llvm-project/pull/147714.diff

1 Files Affected:

  • (modified) llvm/test/CodeGen/SPARC/llvm.sincos.ll (+473-4)
diff --git a/llvm/test/CodeGen/SPARC/llvm.sincos.ll b/llvm/test/CodeGen/SPARC/llvm.sincos.ll
index e447366bc1ced..87b9c8e7ba47b 100644
--- a/llvm/test/CodeGen/SPARC/llvm.sincos.ll
+++ b/llvm/test/CodeGen/SPARC/llvm.sincos.ll
@@ -1,8 +1,10 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
-; RUN: llc -mtriple=sparc-unknown-linux < %s | FileCheck -check-prefixes=SPARC32 %s
-; RUN: llc -mtriple=sparc-unknown-solaris < %s | FileCheck -check-prefixes=SPARC32 %s
-; RUN: llc -mtriple=sparc64-unknown-solaris < %s | FileCheck -check-prefixes=SPARC64 %s
-; RUN: llc -mtriple=sparc64-unknown-linux < %s | FileCheck -check-prefixes=SPARC64 %s
+; RUN: llc -mtriple=sparc-unknown-linux < %s | FileCheck -check-prefix=SPARC32 %s
+; RUN: llc -mtriple=sparc-unknown-solaris < %s | FileCheck -check-prefix=SPARC32 %s
+; RUN: llc -mtriple=sparc64-unknown-solaris < %s | FileCheck -check-prefix=SPARC64 %s
+; RUN: llc -mtriple=sparc64-unknown-linux < %s | FileCheck -check-prefix=SPARC64 %s
+; RUN: llc -mtriple=sparc-unknown-linux-gnu < %s | FileCheck -check-prefix=GNU32 %s
+; RUN: llc -mtriple=sparc64-unknown-linux-gnu < %s | FileCheck -check-prefix=GNU64 %s
 
 define { half, half } @test_sincos_f16(half %a) #0 {
 ; SPARC32-LABEL: test_sincos_f16:
@@ -42,6 +44,40 @@ define { half, half } @test_sincos_f16(half %a) #0 {
 ; SPARC64-NEXT:    ld [%fp+2043], %f0 ! 4-byte Folded Reload
 ; SPARC64-NEXT:    ret
 ; SPARC64-NEXT:    restore
+;
+; GNU32-LABEL: test_sincos_f16:
+; GNU32:       ! %bb.0:
+; GNU32-NEXT:    save %sp, -104, %sp
+; GNU32-NEXT:    call __truncsfhf2
+; GNU32-NEXT:    mov %i0, %o0
+; GNU32-NEXT:    call __extendhfsf2
+; GNU32-NEXT:    nop
+; GNU32-NEXT:    st %f0, [%fp+-12]
+; GNU32-NEXT:    ld [%fp+-12], %o0
+; GNU32-NEXT:    add %fp, -4, %o1
+; GNU32-NEXT:    call sincosf
+; GNU32-NEXT:    add %fp, -8, %o2
+; GNU32-NEXT:    ld [%fp+-4], %f0
+; GNU32-NEXT:    ld [%fp+-8], %f1
+; GNU32-NEXT:    ret
+; GNU32-NEXT:    restore
+;
+; GNU64-LABEL: test_sincos_f16:
+; GNU64:       ! %bb.0:
+; GNU64-NEXT:    save %sp, -192, %sp
+; GNU64-NEXT:    call __truncsfhf2
+; GNU64-NEXT:    nop
+; GNU64-NEXT:    call __extendhfsf2
+; GNU64-NEXT:    nop
+; GNU64-NEXT:    add %fp, 2043, %o1
+; GNU64-NEXT:    add %fp, 2039, %o2
+; GNU64-NEXT:    fmovs %f0, %f1
+; GNU64-NEXT:    call sincosf
+; GNU64-NEXT:    nop
+; GNU64-NEXT:    ld [%fp+2043], %f0
+; GNU64-NEXT:    ld [%fp+2039], %f1
+; GNU64-NEXT:    ret
+; GNU64-NEXT:    restore
   %result = call { half, half } @llvm.sincos.f16(half %a)
   ret { half, half } %result
 }
@@ -72,6 +108,38 @@ define half @test_sincos_f16_only_use_sin(half %a) #0 {
 ; SPARC64-NEXT:    nop
 ; SPARC64-NEXT:    ret
 ; SPARC64-NEXT:    restore
+;
+; GNU32-LABEL: test_sincos_f16_only_use_sin:
+; GNU32:       ! %bb.0:
+; GNU32-NEXT:    save %sp, -104, %sp
+; GNU32-NEXT:    call __truncsfhf2
+; GNU32-NEXT:    mov %i0, %o0
+; GNU32-NEXT:    call __extendhfsf2
+; GNU32-NEXT:    nop
+; GNU32-NEXT:    st %f0, [%fp+-12]
+; GNU32-NEXT:    ld [%fp+-12], %o0
+; GNU32-NEXT:    add %fp, -4, %o1
+; GNU32-NEXT:    call sincosf
+; GNU32-NEXT:    add %fp, -8, %o2
+; GNU32-NEXT:    ld [%fp+-4], %f0
+; GNU32-NEXT:    ret
+; GNU32-NEXT:    restore
+;
+; GNU64-LABEL: test_sincos_f16_only_use_sin:
+; GNU64:       ! %bb.0:
+; GNU64-NEXT:    save %sp, -192, %sp
+; GNU64-NEXT:    call __truncsfhf2
+; GNU64-NEXT:    nop
+; GNU64-NEXT:    call __extendhfsf2
+; GNU64-NEXT:    nop
+; GNU64-NEXT:    add %fp, 2043, %o1
+; GNU64-NEXT:    add %fp, 2039, %o2
+; GNU64-NEXT:    fmovs %f0, %f1
+; GNU64-NEXT:    call sincosf
+; GNU64-NEXT:    nop
+; GNU64-NEXT:    ld [%fp+2043], %f0
+; GNU64-NEXT:    ret
+; GNU64-NEXT:    restore
   %result = call { half, half } @llvm.sincos.f16(half %a)
   %result.0 = extractvalue { half, half } %result, 0
   ret half %result.0
@@ -103,6 +171,38 @@ define half @test_sincos_f16_only_use_cos(half %a) #0 {
 ; SPARC64-NEXT:    nop
 ; SPARC64-NEXT:    ret
 ; SPARC64-NEXT:    restore
+;
+; GNU32-LABEL: test_sincos_f16_only_use_cos:
+; GNU32:       ! %bb.0:
+; GNU32-NEXT:    save %sp, -104, %sp
+; GNU32-NEXT:    call __truncsfhf2
+; GNU32-NEXT:    mov %i0, %o0
+; GNU32-NEXT:    call __extendhfsf2
+; GNU32-NEXT:    nop
+; GNU32-NEXT:    st %f0, [%fp+-12]
+; GNU32-NEXT:    ld [%fp+-12], %o0
+; GNU32-NEXT:    add %fp, -4, %o1
+; GNU32-NEXT:    call sincosf
+; GNU32-NEXT:    add %fp, -8, %o2
+; GNU32-NEXT:    ld [%fp+-8], %f0
+; GNU32-NEXT:    ret
+; GNU32-NEXT:    restore
+;
+; GNU64-LABEL: test_sincos_f16_only_use_cos:
+; GNU64:       ! %bb.0:
+; GNU64-NEXT:    save %sp, -192, %sp
+; GNU64-NEXT:    call __truncsfhf2
+; GNU64-NEXT:    nop
+; GNU64-NEXT:    call __extendhfsf2
+; GNU64-NEXT:    nop
+; GNU64-NEXT:    add %fp, 2043, %o1
+; GNU64-NEXT:    add %fp, 2039, %o2
+; GNU64-NEXT:    fmovs %f0, %f1
+; GNU64-NEXT:    call sincosf
+; GNU64-NEXT:    nop
+; GNU64-NEXT:    ld [%fp+2039], %f0
+; GNU64-NEXT:    ret
+; GNU64-NEXT:    restore
   %result = call { half, half } @llvm.sincos.f16(half %a)
   %result.1 = extractvalue { half, half } %result, 1
   ret half %result.1
@@ -177,6 +277,66 @@ define { <2 x half>, <2 x half> } @test_sincos_v2f16(<2 x half> %a) #0 {
 ; SPARC64-NEXT:    ld [%fp+2031], %f2 ! 4-byte Folded Reload
 ; SPARC64-NEXT:    ret
 ; SPARC64-NEXT:    restore
+;
+; GNU32-LABEL: test_sincos_v2f16:
+; GNU32:       ! %bb.0:
+; GNU32-NEXT:    save %sp, -120, %sp
+; GNU32-NEXT:    call __truncsfhf2
+; GNU32-NEXT:    mov %i1, %o0
+; GNU32-NEXT:    call __extendhfsf2
+; GNU32-NEXT:    nop
+; GNU32-NEXT:    st %f0, [%fp+-28] ! 4-byte Folded Spill
+; GNU32-NEXT:    call __truncsfhf2
+; GNU32-NEXT:    mov %i0, %o0
+; GNU32-NEXT:    call __extendhfsf2
+; GNU32-NEXT:    nop
+; GNU32-NEXT:    st %f0, [%fp+-20]
+; GNU32-NEXT:    ld [%fp+-20], %o0
+; GNU32-NEXT:    add %fp, -12, %o1
+; GNU32-NEXT:    call sincosf
+; GNU32-NEXT:    add %fp, -16, %o2
+; GNU32-NEXT:    ld [%fp+-28], %f0 ! 4-byte Folded Reload
+; GNU32-NEXT:    st %f0, [%fp+-24]
+; GNU32-NEXT:    ld [%fp+-24], %o0
+; GNU32-NEXT:    add %fp, -4, %o1
+; GNU32-NEXT:    call sincosf
+; GNU32-NEXT:    add %fp, -8, %o2
+; GNU32-NEXT:    ld [%fp+-12], %f0
+; GNU32-NEXT:    ld [%fp+-4], %f1
+; GNU32-NEXT:    ld [%fp+-16], %f2
+; GNU32-NEXT:    ld [%fp+-8], %f3
+; GNU32-NEXT:    ret
+; GNU32-NEXT:    restore
+;
+; GNU64-LABEL: test_sincos_v2f16:
+; GNU64:       ! %bb.0:
+; GNU64-NEXT:    save %sp, -208, %sp
+; GNU64-NEXT:    st %f1, [%fp+2023] ! 4-byte Folded Spill
+; GNU64-NEXT:    fmovs %f3, %f1
+; GNU64-NEXT:    call __truncsfhf2
+; GNU64-NEXT:    nop
+; GNU64-NEXT:    call __extendhfsf2
+; GNU64-NEXT:    nop
+; GNU64-NEXT:    st %f0, [%fp+2027] ! 4-byte Folded Spill
+; GNU64-NEXT:    call __truncsfhf2
+; GNU64-NEXT:    ld [%fp+2023], %f1
+; GNU64-NEXT:    call __extendhfsf2
+; GNU64-NEXT:    nop
+; GNU64-NEXT:    add %fp, 2035, %o1
+; GNU64-NEXT:    add %fp, 2031, %o2
+; GNU64-NEXT:    fmovs %f0, %f1
+; GNU64-NEXT:    call sincosf
+; GNU64-NEXT:    nop
+; GNU64-NEXT:    add %fp, 2043, %o1
+; GNU64-NEXT:    add %fp, 2039, %o2
+; GNU64-NEXT:    call sincosf
+; GNU64-NEXT:    ld [%fp+2027], %f1
+; GNU64-NEXT:    ld [%fp+2035], %f0
+; GNU64-NEXT:    ld [%fp+2043], %f1
+; GNU64-NEXT:    ld [%fp+2031], %f2
+; GNU64-NEXT:    ld [%fp+2039], %f3
+; GNU64-NEXT:    ret
+; GNU64-NEXT:    restore
   %result = call { <2 x half>, <2 x half> } @llvm.sincos.v2f16(<2 x half> %a)
   ret { <2 x half>, <2 x half> } %result
 }
@@ -211,6 +371,29 @@ define { float, float } @test_sincos_f32(float %a) #0 {
 ; SPARC64-NEXT:    ld [%fp+2043], %f0 ! 4-byte Folded Reload
 ; SPARC64-NEXT:    ret
 ; SPARC64-NEXT:    restore
+;
+; GNU32-LABEL: test_sincos_f32:
+; GNU32:       ! %bb.0:
+; GNU32-NEXT:    save %sp, -104, %sp
+; GNU32-NEXT:    mov %i0, %o0
+; GNU32-NEXT:    add %fp, -4, %o1
+; GNU32-NEXT:    call sincosf
+; GNU32-NEXT:    add %fp, -8, %o2
+; GNU32-NEXT:    ld [%fp+-4], %f0
+; GNU32-NEXT:    ld [%fp+-8], %f1
+; GNU32-NEXT:    ret
+; GNU32-NEXT:    restore
+;
+; GNU64-LABEL: test_sincos_f32:
+; GNU64:       ! %bb.0:
+; GNU64-NEXT:    save %sp, -192, %sp
+; GNU64-NEXT:    add %fp, 2043, %o1
+; GNU64-NEXT:    call sincosf
+; GNU64-NEXT:    add %fp, 2039, %o2
+; GNU64-NEXT:    ld [%fp+2043], %f0
+; GNU64-NEXT:    ld [%fp+2039], %f1
+; GNU64-NEXT:    ret
+; GNU64-NEXT:    restore
   %result = call { float, float } @llvm.sincos.f32(float %a)
   ret { float, float } %result
 }
@@ -266,6 +449,42 @@ define { <2 x float>, <2 x float> } @test_sincos_v2f32(<2 x float> %a) #0 {
 ; SPARC64-NEXT:    ld [%fp+2031], %f2 ! 4-byte Folded Reload
 ; SPARC64-NEXT:    ret
 ; SPARC64-NEXT:    restore
+;
+; GNU32-LABEL: test_sincos_v2f32:
+; GNU32:       ! %bb.0:
+; GNU32-NEXT:    save %sp, -112, %sp
+; GNU32-NEXT:    mov %i0, %o0
+; GNU32-NEXT:    add %fp, -12, %o1
+; GNU32-NEXT:    call sincosf
+; GNU32-NEXT:    add %fp, -16, %o2
+; GNU32-NEXT:    add %fp, -4, %o1
+; GNU32-NEXT:    add %fp, -8, %o2
+; GNU32-NEXT:    call sincosf
+; GNU32-NEXT:    mov %i1, %o0
+; GNU32-NEXT:    ld [%fp+-12], %f0
+; GNU32-NEXT:    ld [%fp+-4], %f1
+; GNU32-NEXT:    ld [%fp+-16], %f2
+; GNU32-NEXT:    ld [%fp+-8], %f3
+; GNU32-NEXT:    ret
+; GNU32-NEXT:    restore
+;
+; GNU64-LABEL: test_sincos_v2f32:
+; GNU64:       ! %bb.0:
+; GNU64-NEXT:    save %sp, -208, %sp
+; GNU64-NEXT:    st %f3, [%fp+2027] ! 4-byte Folded Spill
+; GNU64-NEXT:    add %fp, 2035, %o1
+; GNU64-NEXT:    call sincosf
+; GNU64-NEXT:    add %fp, 2031, %o2
+; GNU64-NEXT:    add %fp, 2043, %o1
+; GNU64-NEXT:    add %fp, 2039, %o2
+; GNU64-NEXT:    call sincosf
+; GNU64-NEXT:    ld [%fp+2027], %f1
+; GNU64-NEXT:    ld [%fp+2035], %f0
+; GNU64-NEXT:    ld [%fp+2043], %f1
+; GNU64-NEXT:    ld [%fp+2031], %f2
+; GNU64-NEXT:    ld [%fp+2039], %f3
+; GNU64-NEXT:    ret
+; GNU64-NEXT:    restore
 ; CHECKR2-LABEL: test_sincos_v2f32:
 ; CHECKR2:       # %bb.0:
 ; CHECKR2-NEXT:    daddiu $sp, $sp, -32
@@ -383,6 +602,50 @@ define { <3 x float>, <3 x float> } @test_sincos_v3f32(<3 x float> %a) #0 {
 ; SPARC64-NEXT:    ld [%fp+2039], %f4 ! 4-byte Folded Reload
 ; SPARC64-NEXT:    ret
 ; SPARC64-NEXT:    restore
+;
+; GNU32-LABEL: test_sincos_v3f32:
+; GNU32:       ! %bb.0:
+; GNU32-NEXT:    save %sp, -96, %sp
+; GNU32-NEXT:    ld [%fp+64], %i3
+; GNU32-NEXT:    mov %i2, %o0
+; GNU32-NEXT:    add %i3, 8, %o1
+; GNU32-NEXT:    call sincosf
+; GNU32-NEXT:    add %i3, 24, %o2
+; GNU32-NEXT:    add %i3, 4, %o1
+; GNU32-NEXT:    add %i3, 20, %o2
+; GNU32-NEXT:    call sincosf
+; GNU32-NEXT:    mov %i1, %o0
+; GNU32-NEXT:    add %i3, 16, %o2
+; GNU32-NEXT:    mov %i0, %o0
+; GNU32-NEXT:    call sincosf
+; GNU32-NEXT:    mov %i3, %o1
+; GNU32-NEXT:    ret
+; GNU32-NEXT:    restore
+;
+; GNU64-LABEL: test_sincos_v3f32:
+; GNU64:       ! %bb.0:
+; GNU64-NEXT:    save %sp, -208, %sp
+; GNU64-NEXT:    st %f5, [%fp+2019] ! 4-byte Folded Spill
+; GNU64-NEXT:    st %f3, [%fp+2015] ! 4-byte Folded Spill
+; GNU64-NEXT:    add %fp, 2027, %o1
+; GNU64-NEXT:    call sincosf
+; GNU64-NEXT:    add %fp, 2023, %o2
+; GNU64-NEXT:    add %fp, 2035, %o1
+; GNU64-NEXT:    add %fp, 2031, %o2
+; GNU64-NEXT:    call sincosf
+; GNU64-NEXT:    ld [%fp+2015], %f1
+; GNU64-NEXT:    add %fp, 2043, %o1
+; GNU64-NEXT:    add %fp, 2039, %o2
+; GNU64-NEXT:    call sincosf
+; GNU64-NEXT:    ld [%fp+2019], %f1
+; GNU64-NEXT:    ld [%fp+2027], %f0
+; GNU64-NEXT:    ld [%fp+2035], %f1
+; GNU64-NEXT:    ld [%fp+2043], %f2
+; GNU64-NEXT:    ld [%fp+2023], %f3
+; GNU64-NEXT:    ld [%fp+2031], %f4
+; GNU64-NEXT:    ld [%fp+2039], %f5
+; GNU64-NEXT:    ret
+; GNU64-NEXT:    restore
 ; CHECKR2-LABEL: test_sincos_v3f32:
 ; CHECKR2:       # %bb.0:
 ; CHECKR2-NEXT:    daddiu $sp, $sp, -48
@@ -466,6 +729,34 @@ define { double, double } @test_sincos_f64(double %a) #0 {
 ; SPARC64-NEXT:    ldd [%fp+2039], %f0 ! 8-byte Folded Reload
 ; SPARC64-NEXT:    ret
 ; SPARC64-NEXT:    restore
+;
+; GNU32-LABEL: test_sincos_f64:
+; GNU32:       ! %bb.0:
+; GNU32-NEXT:    save %sp, -128, %sp
+; GNU32-NEXT:    ! kill: def $i1 killed $i1 killed $i0_i1 def $i0_i1
+; GNU32-NEXT:    ! kill: def $i0 killed $i0 killed $i0_i1 def $i0_i1
+; GNU32-NEXT:    std %i0, [%fp+-8]
+; GNU32-NEXT:    ldd [%fp+-8], %f0
+; GNU32-NEXT:    std %f0, [%fp+-32]
+; GNU32-NEXT:    ldd [%fp+-32], %o0
+; GNU32-NEXT:    add %fp, -16, %o2
+; GNU32-NEXT:    call sincos
+; GNU32-NEXT:    add %fp, -24, %o3
+; GNU32-NEXT:    ldd [%fp+-16], %f0
+; GNU32-NEXT:    ldd [%fp+-24], %f2
+; GNU32-NEXT:    ret
+; GNU32-NEXT:    restore
+;
+; GNU64-LABEL: test_sincos_f64:
+; GNU64:       ! %bb.0:
+; GNU64-NEXT:    save %sp, -192, %sp
+; GNU64-NEXT:    add %fp, 2039, %o1
+; GNU64-NEXT:    call sincos
+; GNU64-NEXT:    add %fp, 2031, %o2
+; GNU64-NEXT:    ldd [%fp+2039], %f0
+; GNU64-NEXT:    ldd [%fp+2031], %f2
+; GNU64-NEXT:    ret
+; GNU64-NEXT:    restore
   %result = call { double, double } @llvm.sincos.f64(double %a)
   ret { double, double } %result
 }
@@ -533,6 +824,51 @@ define { <2 x double>, <2 x double> } @test_sincos_v2f64(<2 x double> %a) #0 {
 ; SPARC64-NEXT:    ldd [%fp+2015], %f4 ! 8-byte Folded Reload
 ; SPARC64-NEXT:    ret
 ; SPARC64-NEXT:    restore
+;
+; GNU32-LABEL: test_sincos_v2f64:
+; GNU32:       ! %bb.0:
+; GNU32-NEXT:    save %sp, -136, %sp
+; GNU32-NEXT:    ! kill: def $i1 killed $i1 killed $i0_i1 def $i0_i1
+; GNU32-NEXT:    ! kill: def $i3 killed $i3 killed $i2_i3 def $i2_i3
+; GNU32-NEXT:    ! kill: def $i0 killed $i0 killed $i0_i1 def $i0_i1
+; GNU32-NEXT:    std %i0, [%fp+-8]
+; GNU32-NEXT:    ! kill: def $i2 killed $i2 killed $i2_i3 def $i2_i3
+; GNU32-NEXT:    std %i2, [%fp+-16]
+; GNU32-NEXT:    ld [%fp+64], %i0
+; GNU32-NEXT:    ldd [%fp+-16], %f0
+; GNU32-NEXT:    ldd [%fp+-8], %f2
+; GNU32-NEXT:    std %f2, [%fp+-40] ! 8-byte Folded Spill
+; GNU32-NEXT:    std %f0, [%fp+-32]
+; GNU32-NEXT:    ldd [%fp+-32], %o0
+; GNU32-NEXT:    add %i0, 8, %o2
+; GNU32-NEXT:    call sincos
+; GNU32-NEXT:    add %i0, 24, %o3
+; GNU32-NEXT:    ldd [%fp+-40], %f0 ! 8-byte Folded Reload
+; GNU32-NEXT:    std %f0, [%fp+-24]
+; GNU32-NEXT:    ldd [%fp+-24], %o0
+; GNU32-NEXT:    add %i0, 16, %o3
+; GNU32-NEXT:    call sincos
+; GNU32-NEXT:    mov %i0, %o2
+; GNU32-NEXT:    ret
+; GNU32-NEXT:    restore
+;
+; GNU64-LABEL: test_sincos_v2f64:
+; GNU64:       ! %bb.0:
+; GNU64-NEXT:    save %sp, -224, %sp
+; GNU64-NEXT:    std %f2, [%fp+2007] ! 8-byte Folded Spill
+; GNU64-NEXT:    add %fp, 2023, %o1
+; GNU64-NEXT:    call sincos
+; GNU64-NEXT:    add %fp, 2015, %o2
+; GNU64-NEXT:    add %fp, 2039, %o1
+; GNU64-NEXT:    add %fp, 2031, %o2
+; GNU64-NEXT:    call sincos
+; GNU64-NEXT:    ldd [%fp+2007], %f0
+; GNU64-NEXT:    ldd [%fp+2023], %f0
+; GNU64-NEXT:    ldd [%fp+2039], %f2
+; GNU64-NEXT:    ldd [%fp+2015], %f4
+; GNU64-NEXT:    ldd [%fp+2031], %f6
+; GNU64-NEXT:    ret
+; GNU64-NEXT:    restore
 ; CHECKR2-LABEL: test_sincos_v2f64:
 ; CHECKR2:       # %bb.0:
 ; CHECKR2-NEXT:    addiu $sp, $sp, -32
@@ -628,6 +964,51 @@ define void @test_sincos_f128(ptr sret({ fp128, fp128 }) %ret, ptr %in) #0 {
 ; SPARC64-NEXT:    std %f0, [%i0]
 ; SPARC64-NEXT:    ret
 ; SPARC64-NEXT:    restore
+;
+; GNU32-LABEL: test_sincos_f128:
+; GNU32:       ! %bb.0:
+; GNU32-NEXT:    save %sp, -136, %sp
+; GNU32-NEXT:    ld [%fp+64], %i1
+; GNU32-NEXT:    ldd [%i0], %f0
+; GNU32-NEXT:    ldd [%i0+8], %f4
+; GNU32-NEXT:    std %f4, [%sp+100]
+; GNU32-NEXT:    add %fp, -16, %o0
+; GNU32-NEXT:    add %fp, -32, %o1
+; GNU32-NEXT:    call sincosl
+; GNU32-NEXT:    std %f0, [%sp+92]
+; GNU32-NEXT:    ldd [%fp+-24], %f0
+; GNU32-NEXT:    ldd [%fp+-32], %f4
+; GNU32-NEXT:    ldd [%fp+-8], %f2
+; GNU32-NEXT:    ldd [%fp+-16], %f8
+; GNU32-NEXT:    std %f0, [%i1+24]
+; GNU32-NEXT:    std %f4, [%i1+16]
+; GNU32-NEXT:    std %f2, [%i1+8]
+; GNU32-NEXT:    std %f8, [%i1]
+; GNU32-NEXT:    jmp %i7+12
+; GNU32-NEXT:    restore %g0, %i1, %o0
+;
+; GNU64-LABEL: test_sincos_f128:
+; GNU64:       ! %bb.0:
+; GNU64-NEXT:    save %sp, -208, %sp
+; GNU64-NEXT:    ldd [%i1], %f0
+; GNU64-NEXT:    ldd [%i1+8], %f2
+; GNU64-NEXT:    add %fp, 2031, %i1
+; GNU64-NEXT:    add %fp, 2015, %i2
+; GNU64-NEXT:    mov %i1, %o2
+; GNU64-NEXT:    call sincosl
+; GNU64-NEXT:    mov %i2, %o3
+; GNU64-NEXT:    or %i1, 8, %i1
+; GNU64-NEXT:    or %i2, 8, %i2
+; GNU64-NEXT:    ldd [%i2], %f0
+; GNU64-NEXT:    ldd [%fp+2015], %f4
+; GNU64-NEXT:    ldd [%i1], %f2
+; GNU64-NEXT:    ldd [%fp+2031], %f8
+; GNU64-NEXT:    std %f0, [%i0+24]
+; GNU64-NEXT:    std %f4, [%i0+16]
+; GNU64-NEXT:    std %f2, [%i0+8]
+; GNU64-NEXT:    std %f8, [%i0]
+; GNU64-NEXT:    ret
+; GNU64-NEXT:    restore
   %a = load fp128, ptr %in
   %result = call { fp128, fp128 } @llvm.sincos.f128(fp128 %a)
   store { fp128, fp128 } %result, ptr %ret
@@ -763,6 +1144,94 @@ define void @test_sincos_v2f128(ptr sret({ <2 x fp128>, <2 x fp128> }) %ret, ptr
 ; SPARC64-NEXT:    std %f0, [%i0]
 ; SPARC64-NEXT:    ret
 ; SPARC64-NEXT:    restore
+;
+; GNU32-LABEL: test_sincos_v2f128:
+; GNU32:       ! %bb.0:
+; GNU32-NEXT:    save %sp, -192, %sp
+; GNU32-NEXT:    mov %i0, %i1
+; GNU32-NEXT:    ld [%fp+64], %i0
+; GNU32-NEXT:    ldd [%i1+16], %f0
+; GNU32-NEXT:    std %f0, [%fp+-80]
+; GNU32-NEXT:    std %f2, [%fp+-72] ! 16-byte Folded Spill
+; GNU32-NEXT:    ldd [%i1+24], %f0
+; GNU32-NEXT:    std %f0, [%fp+-88] ! 8-byte Folded Spill
+; GNU32-NEXT:    ldd [%i1], %f0
+; GNU32-NEXT:    ldd [%i1+8], %f4
+; GNU32-NEXT:    std %f4, [%sp+100]
+; GNU32-NEXT:    add %fp, -48, %o0
+; GNU32-NEXT:    add %fp, -64, %o1
+; GNU32-NEXT:    call sincosl
+; GNU32-NEXT:    std %f0, [%sp+92]
+; GNU32-NEXT:    ldd [%fp+-88], %f0 ! 8-byte Folded Reload
+; GNU32-NEXT:    std %f0, [%sp+100]
+; GNU32-NEXT:    add %fp, -16, %o0
+; GNU32-NEXT:    add %fp, -32, %o1
+; GNU32-NEXT:    ldd [%fp+-80], %f0
+; GNU32-NEXT:    ldd [%fp+-72], %f2 ! 16-byte Folded Reload
+; GNU32-NEXT:    call sincosl
+; GNU32-NEXT:    std %f0, [%sp+92]
+; GNU32-NEXT:    ldd [%fp+-48], %f0
+; GNU32-NEXT:    ldd [%fp+-40], %f8
+; GNU32-NEXT:    ldd [%fp+-16], %f4
+; GNU32-NEXT:    ldd [%fp+-8], %f10
+; GNU32-NEXT:    ldd [%fp+-24], %f12
+; GNU32-NEXT:    ldd [%fp+-32], %f16
+; GNU32-NEXT:    ldd [%fp+-56], %f14
+; GNU32-NEXT:    ldd [%fp+-64], %f20
+; GNU32-NEXT:    std %f12, [%i0+56]
+; GNU32-NEXT:    std %f16, [%i0+48]
+; GNU32-NEXT:    std %f14, [%i0+40]
+; GNU32-NEXT:    std %f20, [%i0+32]
+; GNU32-NEXT:    std %f10, [%i0+24]
+; GNU32-NEXT:    std %f4, [%i0+16]
+; GNU32-NEXT:    std %f8, [%i0+8]
+; GNU32-NEXT:    std %f0, [%i0]
+; GNU32-NEXT:    jmp %i7+12
+; GNU32-NEXT:    restore
+;
+; GNU64-LABEL: test_sincos_v2f128:
+; GNU64:       ! %bb.0:
+; GNU64-NEXT:    save %sp, -256, %sp
+; GNU64-NEXT:    ldd [%i1+16], %f0
+; GNU64-NEXT:    ldd [%i1+24], %f2
+; GNU64-NEXT:    std %f0, [%fp+1967]
+; GNU64-NEXT:    std %f2, [%fp+1975] ! 16-byte Folded Spill
+; GNU64-NEXT:    ldd [%i1], %f0
+; GNU64-NEXT:    ldd [%i1+8], %f2
+; GNU64-NEXT:    add %fp, 1999, %i1
+; GNU64-NEXT:    add %fp, 1983, %i2
+; GNU64-NEXT:    mov %i1, %o2
+; GNU64-NEXT:    call sincosl
+; GNU64-NEXT:    mov %i2, %o3
+; GNU64-NEXT:    add %fp, 2031, %i3
+; GNU64-NEXT:    add %fp, 2015, %i4
+; GNU64-NEXT:    ldd [%fp+1967], %f0
+; GNU64-NEXT:    ldd [%fp+1975], %f2 ! 16-byte Folded Reload
+; GNU64-NEXT:    mov %i3, %o2
+; GNU64-NEXT:    call sincosl
+; GNU64-NEXT:    mov %i4, %o3
+; GNU64-NEXT:    ldd [%fp+1999], %f0
+; GNU64-NEXT:    or %i1, 8, %i1
+; GNU64-NEXT:    ldd [%i1], %f4
+; GNU64-NEXT:    ldd [%fp+2031], %f8
+; GNU64-NEXT:    or %i3, 8, %i1
+; GNU64-NEXT:    ldd [%i1], %f6
+; GNU64-NEXT:    or %i2, 8, %i1
+; GNU64-NEXT:    or %i4, 8, %i2
+; GNU64-NEXT:    ldd [%i2], %f12
+; GNU64-NEXT:    ldd [%fp+2015], %f16
+; GNU64-NEXT:    ldd [%i1], %f14
+; GNU64-NEXT:    ldd [%fp+1983], %f20
+; GNU64-NEXT:    std %f12, [%i0+56]
+; GNU64-NEXT:    std %f16, [%i0+48]
+; GNU64-NEXT:    std %f14, [%i0+40]
+; GNU64-NEXT:    std %f20, [%i0+32]
+; GNU64-NEXT:    std %f6, [%i0+24]
+; GNU64-NEXT:    std %f8, [%i0+16]
+; GNU64-NEXT:    std %f4, [%i0+8]
+; GNU64-NEXT:    std %f0, [%i0]
+; GNU64-NEXT:    ret
+; GNU64-NEXT:    restore
   %a = load <2 x fp128>, ptr %in
   %result = call { <2 x fp128>, <2 x fp128> } @llvm.sincos.v2f128(<2 x fp128> %a)
   store { <2 x fp128>, <2 x fp128> } %result, ptr %ret

Make sure we have tests that emit the sincos call instead of
the separate sin and cos.
@arsenm arsenm force-pushed the users/arsenm/sparc/add-gnu-runline-sincos branch from d36e026 to cfc69d3 Compare July 9, 2025 14:38
@arsenm arsenm force-pushed the users/arsenm/sparc/start-moving-runtime-libcalls-tablegen branch from 38bfe36 to 8dfe2c8 Compare July 9, 2025 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants