[HLSL] Add abs library function
authorChris Bieneman <chris.bieneman@me.com>
Thu, 25 Aug 2022 23:25:20 +0000 (18:25 -0500)
committerChris Bieneman <chris.bieneman@me.com>
Thu, 25 Aug 2022 23:56:51 +0000 (18:56 -0500)
commit18385cffc50a6e549dcf3306cbe8a99e10a11fff
treee807852751f15fc1f49b96fa382f13e60f20ddde
parente723c69b94b9ac9c6977c0df011ee6219e67da4d
[HLSL] Add abs library function

This change exposes the abs library function for HLSL scalar types. Abs
is supported for all scalar, vector and matrix types. This patch only
adds a subset of scalar type support.

Fixes #57100 (https://llvm.org/pr57100)

The full documentation of the HLSL abs function is available here:
https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-abs

Reviewed By: bogner

Differential Revision: https://reviews.llvm.org/D131718
clang/include/clang/Driver/Options.td
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Headers/hlsl/hlsl_intrinsics.h
clang/test/CodeGenHLSL/builtins/abs.hlsl [new file with mode: 0644]