<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/76442>76442</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [PowerPC] fatal error: error in backend: Cannot select: 0x8e697e8320: f128,f128 = fsincos 0x8e697eb450
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          pkubaj
      </td>
    </tr>
</table>

<pre>
    Clang 17.0.6 on Linux (Gentoo ppc64le) and FreeBSD 15.0 (powerpc64le)

Test case:
```
# 1 "" 3
cpowl() { int theta = cosl(theta) * sinl(theta); }
```

Compile with:
`/usr/lib/llvm/17/bin/clang-17 -cc1 -emit-obj -target-cpu ppc64le -mabi=ieeelongdouble -Werror -Weverything -Wno-gnu-line-marker -fgnuc-version=4.2.1 s_cpowl-062d88.c`

Output:
```
fatal error: error in backend: Cannot select: 0x6d420285c0: f128,f128 = fsincos 0x6d4202b6f0
  0x6d4202b6f0: f128,ch,glue = CopyFromReg 0x6d4202b680, Register:f128 $v2, 0x6d4202b680:1
    0x6d42028b70: f128 = Register $v2
    0x6d4202b680: ch,glue = callseq_end 0x6d4202b610, TargetConstant:i64<32>, TargetConstant:i64<0>, 0x6d4202b610:1
 0x6d420288d0: i64 = TargetConstant<32>
      0x6d42028940: i64 = TargetConstant<0>
      0x6d4202b610: ch,glue = PPCISD::CALL_NOP 0x6d4202b530, TargetExternalSymbol:i64'__floatsikf', Register:i64 $x3, Register:i64 $x2, RegisterMask:Untyped, 0x6d4202b530:1
 0x6d4202b5a0: i64 = TargetExternalSymbol'__floatsikf'
 0x6d42028e80: i64 = Register $x3
        0x6d42028cc0: i64 = Register $x2
        0x6d42028d30: Untyped = RegisterMask
        0x6d4202b530: ch,glue = CopyToReg 0x6d420284e0, Register:i64 $x3, 0x6d42028320
 0x6d42028e80: i64 = Register $x3
          0x6d42028320: i64,ch = load<(dereferenceable load (s32) from %ir.theta), sext from i32> 0x6d41fd2050, FrameIndex:i64<1>, undef:i64
            0x6d420282b0: i64 = FrameIndex<1>
            0x6d42028390: i64 = undef
In function: cpowl
```

This issue has been confirmed to happen on Linux, but its origin is WIP patch to switch FreeBSD/powerpc64le to IEEE long double. The issue happens when building msun library (FreeBSD's libm).
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVt9vozgQ_muclxERGAjwkIeUNKdKe7fVbk_7WBkzgLdgc7bpj__-ZEPTJN3sw50UkWQ838z3jRmPmTGilYhbkt6QdL9ik-2U3o5PU8V-ripVv23LnskWomwdrjegJHwRcnoFQvM_UFqlYBz5JumR0AKYrOGgEW--7yFK16HzGtUL6qMLCfck3M3PBzQWODNI4sVCNuHymf_SGCIglBJKIZ5tfFQvPaG5S0eyGxDSgu3QMiDxHrgybtEbvAfdgRHy1EbiGyDZ_tcJ_bNUwyh6hBdhuzNq9DAZTeihF5V79s8DoYcoI_RQCUnogbtKBVEGAecRBDgIG6jqJwSW6RZtwMfpvVoQDKwSJN4LROyVbGs1Vc78A7VW2n0_o36znZAtBD-kClo5Bb2QGAxMP6GGoGnlxINn1EYoSeJ9sqbrCMyjr1AQbmid52t-oe3rZMfJXit4wyzrwTMg8W7-AUJCxfgTytrZSialsmCwR-7iQPi6qRMa0jzlofvfRG5zSvflt6QxQnJljn7VplmywbntA8s7Qsu2n9AHKNX4dtBq-IbtCSAPCS3hG7bCWHRs54Q0eaZu4cwx3kXvGT9y5lV2zOnzvMdagnwCLKHgnB1nfW_wn0eU9Yln5Nk9-G0vlTSWSVcssUlIXMaUxLe_WQ-X5bNwHxqOAvLa8xGbxDO5jLbkOeo4kV4kv0eGV4ALk4sS3N-Xd9_37p2Kd-Xuy5fHv77ef0DS-KQWt68WtWT997ehUv2imGaPj02vmDXiqSE0u9hYz5Imr_EVOz21_8nME4l3f0v7NmJ9VkVH5HMVq5T9ohYXPD8xv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