clang: Fix handling of __builtin_elementwise_copysign
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Fri, 23 Dec 2022 18:11:28 +0000 (13:11 -0500)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Tue, 10 Jan 2023 19:45:23 +0000 (14:45 -0500)
commit2ad4c3c88d884684a3efb42181e87fe305df51bd
tree09da72d26aa3145be9b6f521d23221579bbaabb3
parent10410534696e1922cbed56b229d123b2db4acd8e
clang: Fix handling of __builtin_elementwise_copysign

I realized the handling of copysign made no sense at all.
Only the type of the first operand should really matter, and
it should not perform a conversion between them.

Also fixes misleading errors and producing broken IR for
integers.

We could accept different FP types for the sign argument,
if the intrinsic permitted different types like the DAG node.
As it is we would need to insert a cast, which could have
other effects (like trapping on snan) which should not happen
for a copysign.
clang/lib/Sema/SemaChecking.cpp
clang/test/CodeGen/builtins-elementwise-math.c
clang/test/Sema/builtins-elementwise-math.c