[llvm] [llvm][codegen] Add lowering to all intrinsics available in `math.h`. (PR #162825)

Ingo Müller via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 10 03:56:40 PDT 2025


ingomueller-net wrote:

I produced the list of functions in `math.h` with the following command. A similar command actually shows up in the comments of one of the headers related to `math.h`.

```bash
grep -E "^__MATHCALL(_VEC|X| )" /usr/include/bits/mathcalls.h \
  | sed -r "s-__MATHCALL(_VEC|X| ).?\(--; s|,.*||" \
  | sort > math.lst
```

I produced the list of intrinsics with the following command:

```bash
tail -n+11 build/include/llvm/IR/IntrinsicEnums.inc \
  | head -n-13 | cut -f1 -d, | cut -f1 -d= | tr -d " " \
  | sort > intrinsics.lst
```

Now, the intersection, which are the LLVM intrinsics that have a function with the same name in `math.h`, can be produced as follows:

```bash
join math.lst intrinsics.lst | sort > joined.lst
```

Finally, one can print the list of macro calls with:

```bash
cat joined.lst | while read line; do echo "MATH_INTRINSIC_CASE($line)"; done
```

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


More information about the llvm-commits mailing list