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

    <tr>
        <th>Summary</th>
        <td>
            [KnownFPClass] Add `KnownFPClass::sinpi/cospi`
        </td>
    </tr>

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

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

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

<pre>
    https://github.com/llvm/llvm-project/blob/5a50c15fa686c9c49b78631ac42b133340867ae3/llvm/include/llvm/IR/Intrinsics.td#L1328

`sinpi`/`cospi` have additional deductions available compared to the regular `sin`/`cos`:
- `sinpi(x)` is subnormal if and only if `x` is subnormal (except for `PPCDoubleDouble`).
- `cospi(x)` is never subnormal (except for `PPCDoubleDouble`).

***

Rationale for why these deductions do not work for `PPCDoubleDouble`:

```llvm
; sinpi(1.0 + x) can be approximated by -pi * x or -3.14159 * x. Since
; -3.14159 * subnormal may still be subnormal, we cannot rule out subnormal.
define ppc_fp128 @ret_sinpil(ppc_fp128 nofpclass(nan inf zero sub) %arg) {
  %call = call ppc_fp128 @sinpil(ppc_fp128 %arg)
  ret ppc_fp128 %call
}
 
; cospi(0.5 + x) can be approximated by -pi * x or -3.14159 * x. Since
; -3.14159 * subnormal may still be subnormal, we cannot rule out subnormal.
define ppc_fp128 @ret_cospil(ppc_fp128 nofpclass(nan inf zero sub) %arg) {
  %call = call ppc_fp128 @cospil(ppc_fp128 %arg)
  ret ppc_fp128 %call
}
```

</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzUVUur6zYQ_jXyZjhGlvxceOFz0sClhR5Od91cJHmSqFUkI8l59NcXOa8beimcQhcXBmc8E33fzCdpLELQW4vYk-qVVKtMzHHnfP_7Tx9f3n5llFaZdOO538U4BcIHwtaErbc67maZK7cnbG3M4fbzMnn3B6pI2FoaJwlbV6Kiqqg2om5r1amyk01b80KoksmCc17Stm4E8geOtsrMIz4CXz7Sw0avbdAq5HEkjP9ScNYSOiSradB20qSmqbqaKheWN9iJA4IYRx21s8LAiOOskh9AHIQ2QhoE5faT8DhCdBB3CB63sxEeLrDfgiafJ8YXuHOy9kRYl8h0gDBL6_xeGNAbEHYEZ805-aSmp3_8h7AWTwqnCBu30L2_v63cLA1engt1l9_4Ll098Vk8oP9PiMnYzZbXD3ERCZe1x905iRHwW81GB9ZFODr_578Q8OG-LRdbtpEOhL_CTbMip0DYK6ReQAkLEkFMk3cnvRcRR5BneJk0EDbACZyHF54XZVF1l0gOv2mr8Ar6lHuIsRdnCFEbk8DvYcLe4IiJM7XiZ4Pg5vjIJ3FG3GiLME3q62YqWAukpB7j16V6Q1j7yFi3mZQRIRDWWmFB2w38hd4lwNQbYZXw28VrXgkdIEWUMAYIX8HiPNF8h-IOsSz3GOEplzCSEM0q5a-S3M4KzasfUOel-v9X5-9QfEbn-9kmdMjGno8d70SGfdG0XdewtqXZru_qomsk0k4J1XRV09SVlO1GVZQL3hZFpntGWU07VtC6LBjNy1bWRSG7uqlpVylGSop7oU2erlDu_DbTIczYM1bRosyMkGjCMrgZs3iEJUsYS3Pc98tAlvM2kJIaHWJ4wEQdzTLxf7buaNfvb4u01QqGcUzX-inMB8KH681d32ZrNnvz-Y_CUmAgbH3t4NCzvwMAAP__j3T80A">