[llvm] WebAssembly: Add test for sincos intrinsic (PR #147467)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 8 00:25:23 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-webassembly

Author: Matt Arsenault (arsenm)

<details>
<summary>Changes</summary>



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


1 Files Affected:

- (added) llvm/test/CodeGen/WebAssembly/llvm.sincos.ll (+500) 


``````````diff
diff --git a/llvm/test/CodeGen/WebAssembly/llvm.sincos.ll b/llvm/test/CodeGen/WebAssembly/llvm.sincos.ll
new file mode 100644
index 0000000000000..e01a8c66507b3
--- /dev/null
+++ b/llvm/test/CodeGen/WebAssembly/llvm.sincos.ll
@@ -0,0 +1,500 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
+; RUN: llc -mtriple=wasm32-unknown-unknown < %s | FileCheck -check-prefixes=CHECK,WASM32 %s
+; RUN: llc -mtriple=wasm64-unknown-unknown < %s | FileCheck -check-prefixes=CHECK,WASM64 %s
+
+define { half, half } @test_sincos_f16(half %a) #0 {
+; WASM32-LABEL: test_sincos_f16:
+; WASM32:         .functype test_sincos_f16 (i32, f32) -> ()
+; WASM32-NEXT:  # %bb.0:
+; WASM32-NEXT:    local.get 0
+; WASM32-NEXT:    local.get 1
+; WASM32-NEXT:    call __truncsfhf2
+; WASM32-NEXT:    call __extendhfsf2
+; WASM32-NEXT:    local.tee 1
+; WASM32-NEXT:    call cosf
+; WASM32-NEXT:    call __truncsfhf2
+; WASM32-NEXT:    i32.store16 2
+; WASM32-NEXT:    local.get 0
+; WASM32-NEXT:    local.get 1
+; WASM32-NEXT:    call sinf
+; WASM32-NEXT:    call __truncsfhf2
+; WASM32-NEXT:    i32.store16 0
+; WASM32-NEXT:    # fallthrough-return
+;
+; WASM64-LABEL: test_sincos_f16:
+; WASM64:         .functype test_sincos_f16 (i64, f32) -> ()
+; WASM64-NEXT:  # %bb.0:
+; WASM64-NEXT:    local.get 0
+; WASM64-NEXT:    local.get 1
+; WASM64-NEXT:    call __truncsfhf2
+; WASM64-NEXT:    call __extendhfsf2
+; WASM64-NEXT:    local.tee 1
+; WASM64-NEXT:    call cosf
+; WASM64-NEXT:    call __truncsfhf2
+; WASM64-NEXT:    i32.store16 2
+; WASM64-NEXT:    local.get 0
+; WASM64-NEXT:    local.get 1
+; WASM64-NEXT:    call sinf
+; WASM64-NEXT:    call __truncsfhf2
+; WASM64-NEXT:    i32.store16 0
+; WASM64-NEXT:    # fallthrough-return
+  %result = call { half, half } @llvm.sincos.f16(half %a)
+  ret { half, half } %result
+}
+
+define half @test_sincos_f16_only_use_sin(half %a) #0 {
+; CHECK-LABEL: test_sincos_f16_only_use_sin:
+; CHECK:         .functype test_sincos_f16_only_use_sin (f32) -> (f32)
+; CHECK-NEXT:  # %bb.0:
+; CHECK-NEXT:    local.get 0
+; CHECK-NEXT:    call __truncsfhf2
+; CHECK-NEXT:    call __extendhfsf2
+; CHECK-NEXT:    call sinf
+; CHECK-NEXT:    # fallthrough-return
+  %result = call { half, half } @llvm.sincos.f16(half %a)
+  %result.0 = extractvalue { half, half } %result, 0
+  ret half %result.0
+}
+
+define half @test_sincos_f16_only_use_cos(half %a) #0 {
+; CHECK-LABEL: test_sincos_f16_only_use_cos:
+; CHECK:         .functype test_sincos_f16_only_use_cos (f32) -> (f32)
+; CHECK-NEXT:  # %bb.0:
+; CHECK-NEXT:    local.get 0
+; CHECK-NEXT:    call __truncsfhf2
+; CHECK-NEXT:    call __extendhfsf2
+; CHECK-NEXT:    call cosf
+; CHECK-NEXT:    # fallthrough-return
+  %result = call { half, half } @llvm.sincos.f16(half %a)
+  %result.1 = extractvalue { half, half } %result, 1
+  ret half %result.1
+}
+
+define { <2 x half>, <2 x half> } @test_sincos_v2f16(<2 x half> %a) #0 {
+; WASM32-LABEL: test_sincos_v2f16:
+; WASM32:         .functype test_sincos_v2f16 (i32, f32, f32) -> ()
+; WASM32-NEXT:  # %bb.0:
+; WASM32-NEXT:    local.get 0
+; WASM32-NEXT:    local.get 2
+; WASM32-NEXT:    call __truncsfhf2
+; WASM32-NEXT:    call __extendhfsf2
+; WASM32-NEXT:    local.tee 2
+; WASM32-NEXT:    call cosf
+; WASM32-NEXT:    call __truncsfhf2
+; WASM32-NEXT:    i32.store16 6
+; WASM32-NEXT:    local.get 0
+; WASM32-NEXT:    local.get 1
+; WASM32-NEXT:    call __truncsfhf2
+; WASM32-NEXT:    call __extendhfsf2
+; WASM32-NEXT:    local.tee 1
+; WASM32-NEXT:    call cosf
+; WASM32-NEXT:    call __truncsfhf2
+; WASM32-NEXT:    i32.store16 4
+; WASM32-NEXT:    local.get 0
+; WASM32-NEXT:    local.get 2
+; WASM32-NEXT:    call sinf
+; WASM32-NEXT:    call __truncsfhf2
+; WASM32-NEXT:    i32.store16 2
+; WASM32-NEXT:    local.get 0
+; WASM32-NEXT:    local.get 1
+; WASM32-NEXT:    call sinf
+; WASM32-NEXT:    call __truncsfhf2
+; WASM32-NEXT:    i32.store16 0
+; WASM32-NEXT:    # fallthrough-return
+;
+; WASM64-LABEL: test_sincos_v2f16:
+; WASM64:         .functype test_sincos_v2f16 (i64, f32, f32) -> ()
+; WASM64-NEXT:  # %bb.0:
+; WASM64-NEXT:    local.get 0
+; WASM64-NEXT:    local.get 2
+; WASM64-NEXT:    call __truncsfhf2
+; WASM64-NEXT:    call __extendhfsf2
+; WASM64-NEXT:    local.tee 2
+; WASM64-NEXT:    call cosf
+; WASM64-NEXT:    call __truncsfhf2
+; WASM64-NEXT:    i32.store16 6
+; WASM64-NEXT:    local.get 0
+; WASM64-NEXT:    local.get 1
+; WASM64-NEXT:    call __truncsfhf2
+; WASM64-NEXT:    call __extendhfsf2
+; WASM64-NEXT:    local.tee 1
+; WASM64-NEXT:    call cosf
+; WASM64-NEXT:    call __truncsfhf2
+; WASM64-NEXT:    i32.store16 4
+; WASM64-NEXT:    local.get 0
+; WASM64-NEXT:    local.get 2
+; WASM64-NEXT:    call sinf
+; WASM64-NEXT:    call __truncsfhf2
+; WASM64-NEXT:    i32.store16 2
+; WASM64-NEXT:    local.get 0
+; WASM64-NEXT:    local.get 1
+; WASM64-NEXT:    call sinf
+; WASM64-NEXT:    call __truncsfhf2
+; WASM64-NEXT:    i32.store16 0
+; WASM64-NEXT:    # fallthrough-return
+  %result = call { <2 x half>, <2 x half> } @llvm.sincos.v2f16(<2 x half> %a)
+  ret { <2 x half>, <2 x half> } %result
+}
+
+define { float, float } @test_sincos_f32(float %a) #0 {
+; WASM32-LABEL: test_sincos_f32:
+; WASM32:         .functype test_sincos_f32 (i32, f32) -> ()
+; WASM32-NEXT:  # %bb.0:
+; WASM32-NEXT:    local.get 0
+; WASM32-NEXT:    local.get 1
+; WASM32-NEXT:    call cosf
+; WASM32-NEXT:    f32.store 4
+; WASM32-NEXT:    local.get 0
+; WASM32-NEXT:    local.get 1
+; WASM32-NEXT:    call sinf
+; WASM32-NEXT:    f32.store 0
+; WASM32-NEXT:    # fallthrough-return
+;
+; WASM64-LABEL: test_sincos_f32:
+; WASM64:         .functype test_sincos_f32 (i64, f32) -> ()
+; WASM64-NEXT:  # %bb.0:
+; WASM64-NEXT:    local.get 0
+; WASM64-NEXT:    local.get 1
+; WASM64-NEXT:    call cosf
+; WASM64-NEXT:    f32.store 4
+; WASM64-NEXT:    local.get 0
+; WASM64-NEXT:    local.get 1
+; WASM64-NEXT:    call sinf
+; WASM64-NEXT:    f32.store 0
+; WASM64-NEXT:    # fallthrough-return
+  %result = call { float, float } @llvm.sincos.f32(float %a)
+  ret { float, float } %result
+}
+
+define { <2 x float>, <2 x float> } @test_sincos_v2f32(<2 x float> %a) #0 {
+; CHECKR2-LABEL: test_sincos_v2f32:
+; CHECKR2:       # %bb.0:
+; CHECKR2-NEXT:    daddiu $sp, $sp, -32
+; CHECKR2-NEXT:    sd $ra, 24($sp) # 8-byte Folded Spill
+; CHECKR2-NEXT:    sd $16, 16($sp) # 8-byte Folded Spill
+; CHECKR2-NEXT:    move $16, $4
+; CHECKR2-NEXT:    dsrl $1, $4, 32
+; CHECKR2-NEXT:    sll $1, $1, 0
+; CHECKR2-NEXT:    mtc1 $1, $f12
+; CHECKR2-NEXT:    daddiu $5, $sp, 12
+; CHECKR2-NEXT:    jal sincosf
+; CHECKR2-NEXT:    daddiu $6, $sp, 8
+; CHECKR2-NEXT:    sll $1, $16, 0
+; CHECKR2-NEXT:    mtc1 $1, $f12
+; CHECKR2-NEXT:    daddiu $5, $sp, 4
+; CHECKR2-NEXT:    jal sincosf
+; CHECKR2-NEXT:    daddiu $6, $sp, 0
+; CHECKR2-NEXT:    lwc1 $f0, 12($sp)
+; CHECKR2-NEXT:    mfc1 $1, $f0
+; CHECKR2-NEXT:    dsll $1, $1, 32
+; CHECKR2-NEXT:    lwc1 $f0, 4($sp)
+; CHECKR2-NEXT:    mfc1 $2, $f0
+; CHECKR2-NEXT:    dext $2, $2, 0, 32
+; CHECKR2-NEXT:    lwc1 $f0, 8($sp)
+; CHECKR2-NEXT:    or $2, $2, $1
+; CHECKR2-NEXT:    mfc1 $1, $f0
+; CHECKR2-NEXT:    dsll $1, $1, 32
+; CHECKR2-NEXT:    lwc1 $f0, 0($sp)
+; CHECKR2-NEXT:    mfc1 $3, $f0
+; CHECKR2-NEXT:    dext $3, $3, 0, 32
+; CHECKR2-NEXT:    or $3, $3, $1
+; CHECKR2-NEXT:    ld $16, 16($sp) # 8-byte Folded Reload
+; CHECKR2-NEXT:    ld $ra, 24($sp) # 8-byte Folded Reload
+; CHECKR2-NEXT:    jr $ra
+; CHECKR2-NEXT:    daddiu $sp, $sp, 32
+; WASM32-LABEL: test_sincos_v2f32:
+; WASM32:         .functype test_sincos_v2f32 (i32, f32, f32) -> ()
+; WASM32-NEXT:  # %bb.0:
+; WASM32-NEXT:    local.get 0
+; WASM32-NEXT:    local.get 2
+; WASM32-NEXT:    call cosf
+; WASM32-NEXT:    f32.store 12
+; WASM32-NEXT:    local.get 0
+; WASM32-NEXT:    local.get 1
+; WASM32-NEXT:    call cosf
+; WASM32-NEXT:    f32.store 8
+; WASM32-NEXT:    local.get 0
+; WASM32-NEXT:    local.get 2
+; WASM32-NEXT:    call sinf
+; WASM32-NEXT:    f32.store 4
+; WASM32-NEXT:    local.get 0
+; WASM32-NEXT:    local.get 1
+; WASM32-NEXT:    call sinf
+; WASM32-NEXT:    f32.store 0
+; WASM32-NEXT:    # fallthrough-return
+;
+; WASM64-LABEL: test_sincos_v2f32:
+; WASM64:         .functype test_sincos_v2f32 (i64, f32, f32) -> ()
+; WASM64-NEXT:  # %bb.0:
+; WASM64-NEXT:    local.get 0
+; WASM64-NEXT:    local.get 2
+; WASM64-NEXT:    call cosf
+; WASM64-NEXT:    f32.store 12
+; WASM64-NEXT:    local.get 0
+; WASM64-NEXT:    local.get 1
+; WASM64-NEXT:    call cosf
+; WASM64-NEXT:    f32.store 8
+; WASM64-NEXT:    local.get 0
+; WASM64-NEXT:    local.get 2
+; WASM64-NEXT:    call sinf
+; WASM64-NEXT:    f32.store 4
+; WASM64-NEXT:    local.get 0
+; WASM64-NEXT:    local.get 1
+; WASM64-NEXT:    call sinf
+; WASM64-NEXT:    f32.store 0
+; WASM64-NEXT:    # fallthrough-return
+  %result = call { <2 x float>, <2 x float> } @llvm.sincos.v2f32(<2 x float> %a)
+  ret { <2 x float>, <2 x float> } %result
+}
+
+define { <3 x float>, <3 x float> } @test_sincos_v3f32(<3 x float> %a) #0 {
+; CHECKR2-LABEL: test_sincos_v3f32:
+; CHECKR2:       # %bb.0:
+; CHECKR2-NEXT:    daddiu $sp, $sp, -48
+; CHECKR2-NEXT:    sdc1 $f25, 40($sp) # 8-byte Folded Spill
+; CHECKR2-NEXT:    sdc1 $f24, 32($sp) # 8-byte Folded Spill
+; CHECKR2-NEXT:    sd $ra, 24($sp) # 8-byte Folded Spill
+; CHECKR2-NEXT:    sd $16, 16($sp) # 8-byte Folded Spill
+; CHECKR2-NEXT:    mov.s $f24, $f15
+; CHECKR2-NEXT:    mov.s $f25, $f14
+; CHECKR2-NEXT:    mov.s $f12, $f13
+; CHECKR2-NEXT:    move $16, $4
+; CHECKR2-NEXT:    daddiu $5, $sp, 4
+; CHECKR2-NEXT:    jal sincosf
+; CHECKR2-NEXT:    daddiu $6, $sp, 0
+; CHECKR2-NEXT:    daddiu $5, $sp, 12
+; CHECKR2-NEXT:    daddiu $6, $sp, 8
+; CHECKR2-NEXT:    jal sincosf
+; CHECKR2-NEXT:    mov.s $f12, $f25
+; CHECKR2-NEXT:    daddiu $5, $16, 8
+; CHECKR2-NEXT:    daddiu $6, $16, 24
+; CHECKR2-NEXT:    jal sincosf
+; CHECKR2-NEXT:    mov.s $f12, $f24
+; CHECKR2-NEXT:    lwc1 $f0, 0($sp)
+; CHECKR2-NEXT:    mfc1 $1, $f0
+; CHECKR2-NEXT:    dsll $1, $1, 32
+; CHECKR2-NEXT:    lwc1 $f0, 8($sp)
+; CHECKR2-NEXT:    mfc1 $2, $f0
+; CHECKR2-NEXT:    dext $2, $2, 0, 32
+; CHECKR2-NEXT:    or $1, $2, $1
+; CHECKR2-NEXT:    lwc1 $f0, 4($sp)
+; CHECKR2-NEXT:    mfc1 $2, $f0
+; CHECKR2-NEXT:    sd $1, 16($16)
+; CHECKR2-NEXT:    dsll $1, $2, 32
+; CHECKR2-NEXT:    lwc1 $f0, 12($sp)
+; CHECKR2-NEXT:    mfc1 $2, $f0
+; CHECKR2-NEXT:    dext $2, $2, 0, 32
+; CHECKR2-NEXT:    or $1, $2, $1
+; CHECKR2-NEXT:    sd $1, 0($16)
+; CHECKR2-NEXT:    ld $16, 16($sp) # 8-byte Folded Reload
+; CHECKR2-NEXT:    ld $ra, 24($sp) # 8-byte Folded Reload
+; CHECKR2-NEXT:    ldc1 $f24, 32($sp) # 8-byte Folded Reload
+; CHECKR2-NEXT:    ldc1 $f25, 40($sp) # 8-byte Folded Reload
+; CHECKR2-NEXT:    jr $ra
+; CHECKR2-NEXT:    daddiu $sp, $sp, 48
+; WASM32-LABEL: test_sincos_v3f32:
+; WASM32:         .functype test_sincos_v3f32 (i32, f32, f32, f32) -> ()
+; WASM32-NEXT:  # %bb.0:
+; WASM32-NEXT:    local.get 0
+; WASM32-NEXT:    local.get 3
+; WASM32-NEXT:    call cosf
+; WASM32-NEXT:    f32.store 24
+; WASM32-NEXT:    local.get 0
+; WASM32-NEXT:    local.get 3
+; WASM32-NEXT:    call sinf
+; WASM32-NEXT:    f32.store 8
+; WASM32-NEXT:    local.get 2
+; WASM32-NEXT:    call cosf
+; WASM32-NEXT:    local.set 3
+; WASM32-NEXT:    local.get 0
+; WASM32-NEXT:    local.get 1
+; WASM32-NEXT:    call cosf
+; WASM32-NEXT:    i32.reinterpret_f32
+; WASM32-NEXT:    i64.extend_i32_u
+; WASM32-NEXT:    local.get 3
+; WASM32-NEXT:    i32.reinterpret_f32
+; WASM32-NEXT:    i64.extend_i32_u
+; WASM32-NEXT:    i64.const 32
+; WASM32-NEXT:    i64.shl
+; WASM32-NEXT:    i64.or
+; WASM32-NEXT:    i64.store 16
+; WASM32-NEXT:    local.get 2
+; WASM32-NEXT:    call sinf
+; WASM32-NEXT:    local.set 3
+; WASM32-NEXT:    local.get 0
+; WASM32-NEXT:    local.get 1
+; WASM32-NEXT:    call sinf
+; WASM32-NEXT:    i32.reinterpret_f32
+; WASM32-NEXT:    i64.extend_i32_u
+; WASM32-NEXT:    local.get 3
+; WASM32-NEXT:    i32.reinterpret_f32
+; WASM32-NEXT:    i64.extend_i32_u
+; WASM32-NEXT:    i64.const 32
+; WASM32-NEXT:    i64.shl
+; WASM32-NEXT:    i64.or
+; WASM32-NEXT:    i64.store 0
+; WASM32-NEXT:    # fallthrough-return
+;
+; WASM64-LABEL: test_sincos_v3f32:
+; WASM64:         .functype test_sincos_v3f32 (i64, f32, f32, f32) -> ()
+; WASM64-NEXT:  # %bb.0:
+; WASM64-NEXT:    local.get 0
+; WASM64-NEXT:    local.get 3
+; WASM64-NEXT:    call cosf
+; WASM64-NEXT:    f32.store 24
+; WASM64-NEXT:    local.get 0
+; WASM64-NEXT:    local.get 3
+; WASM64-NEXT:    call sinf
+; WASM64-NEXT:    f32.store 8
+; WASM64-NEXT:    local.get 2
+; WASM64-NEXT:    call cosf
+; WASM64-NEXT:    local.set 3
+; WASM64-NEXT:    local.get 0
+; WASM64-NEXT:    local.get 1
+; WASM64-NEXT:    call cosf
+; WASM64-NEXT:    i32.reinterpret_f32
+; WASM64-NEXT:    i64.extend_i32_u
+; WASM64-NEXT:    local.get 3
+; WASM64-NEXT:    i32.reinterpret_f32
+; WASM64-NEXT:    i64.extend_i32_u
+; WASM64-NEXT:    i64.const 32
+; WASM64-NEXT:    i64.shl
+; WASM64-NEXT:    i64.or
+; WASM64-NEXT:    i64.store 16
+; WASM64-NEXT:    local.get 2
+; WASM64-NEXT:    call sinf
+; WASM64-NEXT:    local.set 3
+; WASM64-NEXT:    local.get 0
+; WASM64-NEXT:    local.get 1
+; WASM64-NEXT:    call sinf
+; WASM64-NEXT:    i32.reinterpret_f32
+; WASM64-NEXT:    i64.extend_i32_u
+; WASM64-NEXT:    local.get 3
+; WASM64-NEXT:    i32.reinterpret_f32
+; WASM64-NEXT:    i64.extend_i32_u
+; WASM64-NEXT:    i64.const 32
+; WASM64-NEXT:    i64.shl
+; WASM64-NEXT:    i64.or
+; WASM64-NEXT:    i64.store 0
+; WASM64-NEXT:    # fallthrough-return
+  %result = call { <3 x float>, <3 x float> } @llvm.sincos.v3f32(<3 x float> %a)
+  ret { <3 x float>, <3 x float> } %result
+}
+
+define { double, double } @test_sincos_f64(double %a) #0 {
+; WASM32-LABEL: test_sincos_f64:
+; WASM32:         .functype test_sincos_f64 (i32, f64) -> ()
+; WASM32-NEXT:  # %bb.0:
+; WASM32-NEXT:    local.get 0
+; WASM32-NEXT:    local.get 1
+; WASM32-NEXT:    call cos
+; WASM32-NEXT:    f64.store 8
+; WASM32-NEXT:    local.get 0
+; WASM32-NEXT:    local.get 1
+; WASM32-NEXT:    call sin
+; WASM32-NEXT:    f64.store 0
+; WASM32-NEXT:    # fallthrough-return
+;
+; WASM64-LABEL: test_sincos_f64:
+; WASM64:         .functype test_sincos_f64 (i64, f64) -> ()
+; WASM64-NEXT:  # %bb.0:
+; WASM64-NEXT:    local.get 0
+; WASM64-NEXT:    local.get 1
+; WASM64-NEXT:    call cos
+; WASM64-NEXT:    f64.store 8
+; WASM64-NEXT:    local.get 0
+; WASM64-NEXT:    local.get 1
+; WASM64-NEXT:    call sin
+; WASM64-NEXT:    f64.store 0
+; WASM64-NEXT:    # fallthrough-return
+  %result = call { double, double } @llvm.sincos.f64(double %a)
+  ret { double, double } %result
+}
+
+define { <2 x double>, <2 x double> } @test_sincos_v2f64(<2 x double> %a) #0 {
+; CHECKR2-LABEL: test_sincos_v2f64:
+; CHECKR2:       # %bb.0:
+; CHECKR2-NEXT:    addiu $sp, $sp, -32
+; CHECKR2-NEXT:    sw $ra, 28($sp) # 4-byte Folded Spill
+; CHECKR2-NEXT:    sw $18, 24($sp) # 4-byte Folded Spill
+; CHECKR2-NEXT:    sw $17, 20($sp) # 4-byte Folded Spill
+; CHECKR2-NEXT:    sw $16, 16($sp) # 4-byte Folded Spill
+; CHECKR2-NEXT:    move $16, $7
+; CHECKR2-NEXT:    move $17, $6
+; CHECKR2-NEXT:    move $18, $4
+; CHECKR2-NEXT:    lw $1, 48($sp)
+; CHECKR2-NEXT:    lw $2, 52($sp)
+; CHECKR2-NEXT:    mtc1 $2, $f12
+; CHECKR2-NEXT:    mthc1 $1, $f12
+; CHECKR2-NEXT:    addiu $6, $4, 8
+; CHECKR2-NEXT:    jal sincos
+; CHECKR2-NEXT:    addiu $7, $4, 24
+; CHECKR2-NEXT:    mtc1 $16, $f12
+; CHECKR2-NEXT:    mthc1 $17, $f12
+; CHECKR2-NEXT:    addiu $7, $18, 16
+; CHECKR2-NEXT:    jal sincos
+; CHECKR2-NEXT:    move $6, $18
+; CHECKR2-NEXT:    lw $16, 16($sp) # 4-byte Folded Reload
+; CHECKR2-NEXT:    lw $17, 20($sp) # 4-byte Folded Reload
+; CHECKR2-NEXT:    lw $18, 24($sp) # 4-byte Folded Reload
+; CHECKR2-NEXT:    lw $ra, 28($sp) # 4-byte Folded Reload
+; CHECKR2-NEXT:    jr $ra
+; CHECKR2-NEXT:    addiu $sp, $sp, 32
+; WASM32-LABEL: test_sincos_v2f64:
+; WASM32:         .functype test_sincos_v2f64 (i32, f64, f64) -> ()
+; WASM32-NEXT:  # %bb.0:
+; WASM32-NEXT:    local.get 0
+; WASM32-NEXT:    local.get 2
+; WASM32-NEXT:    call cos
+; WASM32-NEXT:    f64.store 24
+; WASM32-NEXT:    local.get 0
+; WASM32-NEXT:    local.get 1
+; WASM32-NEXT:    call cos
+; WASM32-NEXT:    f64.store 16
+; WASM32-NEXT:    local.get 0
+; WASM32-NEXT:    local.get 2
+; WASM32-NEXT:    call sin
+; WASM32-NEXT:    f64.store 8
+; WASM32-NEXT:    local.get 0
+; WASM32-NEXT:    local.get 1
+; WASM32-NEXT:    call sin
+; WASM32-NEXT:    f64.store 0
+; WASM32-NEXT:    # fallthrough-return
+;
+; WASM64-LABEL: test_sincos_v2f64:
+; WASM64:         .functype test_sincos_v2f64 (i64, f64, f64) -> ()
+; WASM64-NEXT:  # %bb.0:
+; WASM64-NEXT:    local.get 0
+; WASM64-NEXT:    local.get 2
+; WASM64-NEXT:    call cos
+; WASM64-NEXT:    f64.store 24
+; WASM64-NEXT:    local.get 0
+; WASM64-NEXT:    local.get 1
+; WASM64-NEXT:    call cos
+; WASM64-NEXT:    f64.store 16
+; WASM64-NEXT:    local.get 0
+; WASM64-NEXT:    local.get 2
+; WASM64-NEXT:    call sin
+; WASM64-NEXT:    f64.store 8
+; WASM64-NEXT:    local.get 0
+; WASM64-NEXT:    local.get 1
+; WASM64-NEXT:    call sin
+; WASM64-NEXT:    f64.store 0
+; WASM64-NEXT:    # fallthrough-return
+  %result = call { <2 x double>, <2 x double> } @llvm.sincos.v2f64(<2 x double> %a)
+  ret { <2 x double>, <2 x double> } %result
+}
+
+; ; FIXME: Asserts
+; define { fp128, fp128 } @test_sincos_f128(fp128 %a) #0 {
+;   %result = call { fp128, fp128 } @llvm.sincos.f128(fp128 %a)
+;   ret { fp128, fp128 } %result
+; }
+
+; ; FIXME: Asserts
+; define { <2 x fp128>, <2 x fp128> } @test_sincos_v2f128(<2 x fp128> %a) #0 {
+;   %result = call { <2 x fp128>, <2 x fp128> } @llvm.sincos.v2f128(<2 x fp128> %a)
+;   ret { <2 x fp128>, <2 x fp128> } %result
+; }
+
+attributes #0 = { nounwind }

``````````

</details>


https://github.com/llvm/llvm-project/pull/147467


More information about the llvm-commits mailing list