[clang] [llvm] [InstCombine] Canonicalize `(sitofp x)` -> `(uitofp x)` if `x >= 0` (PR #82404)
topperc wrote: > > > Well, I'm not sure how proper that wold be as a reproducer, > > > I extracted the mentioned test to a program: > > > ``` > > > #include > > > > > > #include "third_party/swiftshader/src/Reactor/Coroutine.hpp" > > > #include "third_party/swiftshader/src/Reactor/Reactor.hpp" > > > > > > using float4 = float[4]; > > > using int4 = int[4]; > > > > > > static std::string testName() { return "test name"; } > > > > > > using namespace rr; > > > > > > int main() { > > > Function, Pointer)> function; > > > { > > > Pointer x = function.Arg<0>(); > > > Pointer y = function.Arg<1>(); > > > > > > *y = Abs(*x); > > > } > > > > > > auto routine = function(testName().c_str()); > > > auto callable = (void (*)(int4 *, int4 *))routine->getEntry(); > > > > > > int input[] = {1, -1, 0, (int)0x8000}; > > > > > > for (int x : input) { > > > int4 v_in = {x, x, x, x}; > > > int4 v_out = {0}; > > > > > > callable(&v_in, &v_out); > > > > > > float expected = abs(x); > > > if (v_out[0] != expected) { > > > return 10; > > > } > > > } > > > } > > > ``` > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Before the change program exits with 0, after it exists with 10. More > > > precisely: `v_out[0]` is: -2147483648, `expected` is: 2.14748365e+09 > > > [out_at.txt](https://github.com/llvm/llvm-project/files/14670227/out_at.txt) > > > > > > [out_before.txt](https://github.com/llvm/llvm-project/files/14670228/out_before.txt) > > > I attached the generated IR before and after the change. It's only one > > > line diff: > > > ``` > > >call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 > > > dereferenceable(16) %9, i8 0, i64 16, i1 false) > > >call void %49(ptr noundef nonnull %8, ptr noundef nonnull %9) #16 > > >%61 = call i32 @llvm.abs.i32(i32 %60, i1 true) > > > - %62 = sitofp i32 %61 to float > > > + %62 = uitofp i32 %61 to float > > >%63 = load i32, ptr %9, align 16 > > >%64 = sitofp i32 %63 to float > > >%65 = fcmp une float %64, %62 > > > ``` > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > generation command is `clang -O1 -fsized-deallocation '-std=gnu++20' -c > > > pre.ii -emit-llvm -S -o /tmp/ir_before.ll` > > > I'm trying to reduce the preprocessed file, tho not sure i'll keep the > > > semantics of the failure. > > > > > > This should be sufficient, thank you! > > Might have been related to: > [1283646](https://github.com/llvm/llvm-project/commit/12836467b76c56872b4c22a6fd44bcda696ea720) Doesn't that program call `abs` on 0x8000 which is poison? https://github.com/llvm/llvm-project/pull/82404 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [InstCombine] Canonicalize `(sitofp x)` -> `(uitofp x)` if `x >= 0` (PR #82404)
goldsteinn wrote: > > Well, I'm not sure how proper that wold be as a reproducer, > > I extracted the mentioned test to a program: > > ``` > > #include > > > > #include "third_party/swiftshader/src/Reactor/Coroutine.hpp" > > #include "third_party/swiftshader/src/Reactor/Reactor.hpp" > > > > using float4 = float[4]; > > using int4 = int[4]; > > > > static std::string testName() { return "test name"; } > > > > using namespace rr; > > > > int main() { > > Function, Pointer)> function; > > { > > Pointer x = function.Arg<0>(); > > Pointer y = function.Arg<1>(); > > > > *y = Abs(*x); > > } > > > > auto routine = function(testName().c_str()); > > auto callable = (void (*)(int4 *, int4 *))routine->getEntry(); > > > > int input[] = {1, -1, 0, (int)0x8000}; > > > > for (int x : input) { > > int4 v_in = {x, x, x, x}; > > int4 v_out = {0}; > > > > callable(&v_in, &v_out); > > > > float expected = abs(x); > > if (v_out[0] != expected) { > > return 10; > > } > > } > > } > > ``` > > > > > > > > > > > > > > > > > > > > > > > > Before the change program exits with 0, after it exists with 10. More > > precisely: `v_out[0]` is: -2147483648, `expected` is: 2.14748365e+09 > > [out_at.txt](https://github.com/llvm/llvm-project/files/14670227/out_at.txt) > > > > [out_before.txt](https://github.com/llvm/llvm-project/files/14670228/out_before.txt) > > I attached the generated IR before and after the change. It's only one line > > diff: > > ``` > >call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 > > dereferenceable(16) %9, i8 0, i64 16, i1 false) > >call void %49(ptr noundef nonnull %8, ptr noundef nonnull %9) #16 > >%61 = call i32 @llvm.abs.i32(i32 %60, i1 true) > > - %62 = sitofp i32 %61 to float > > + %62 = uitofp i32 %61 to float > >%63 = load i32, ptr %9, align 16 > >%64 = sitofp i32 %63 to float > >%65 = fcmp une float %64, %62 > > ``` > > > > > > > > > > > > > > > > > > > > > > > > generation command is `clang -O1 -fsized-deallocation '-std=gnu++20' -c > > pre.ii -emit-llvm -S -o /tmp/ir_before.ll` > > I'm trying to reduce the preprocessed file, tho not sure i'll keep the > > semantics of the failure. > > This should be sufficient, thank you! Might have been related to: https://github.com/llvm/llvm-project/commit/12836467b76c56872b4c22a6fd44bcda696ea720 https://github.com/llvm/llvm-project/pull/82404 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [InstCombine] Canonicalize `(sitofp x)` -> `(uitofp x)` if `x >= 0` (PR #82404)
goldsteinn wrote: See: https://github.com/llvm/llvm-project/pull/86141 which adds `nneg` flag to IR. Once that gets in I have patches for instcombine,cvp,sccp to do the transform. https://github.com/llvm/llvm-project/pull/82404 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [InstCombine] Canonicalize `(sitofp x)` -> `(uitofp x)` if `x >= 0` (PR #82404)
topperc wrote: > > Apart from the correctness issues, we've seen some regressions on various > > benchmarks from LLVM Test Suite after this patch. Specifically, around 3-5% > > regression on x86-64 in various metrics of the > > [Interpolation](https://github.com/llvm/llvm-test-suite/tree/main/MicroBenchmarks/ImageProcessing/Interpolation) > > benchmarks, and up to 30% regression on a number of floating point-centric > > benchmarks from > > https://github.com/llvm/llvm-test-suite/tree/main/SingleSource/Benchmarks/Misc > > (flops-4.c, flops-5.c, flops-6.c, flops-8.c, fp-convert.c). The numbers > > vary depending on the microarchitecture, with Skylake being less affected > > (on the order of ~10%) and AMD Rome showing larger regressions (up to 30%). > > FYI this patch saves ~3% instructions for some benchmarks from > LLVM-test-suite on RISC-V. > [dtcxzyw/llvm-ci#1115](https://github.com/dtcxzyw/llvm-ci/issues/1115) > [dtcxzyw/llvm-ci#1114](https://github.com/dtcxzyw/llvm-ci/issues/1114) Are you able to extract a reproducer that I can look at? https://github.com/llvm/llvm-project/pull/82404 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [InstCombine] Canonicalize `(sitofp x)` -> `(uitofp x)` if `x >= 0` (PR #82404)
dtcxzyw wrote: > Apart from the correctness issues, we've seen some regressions on various > benchmarks from LLVM Test Suite after this patch. Specifically, around 3-5% > regression on x86-64 in various metrics of the > [Interpolation](https://github.com/llvm/llvm-test-suite/tree/main/MicroBenchmarks/ImageProcessing/Interpolation) > benchmarks, and up to 30% regression on a number of floating point-centric > benchmarks from > https://github.com/llvm/llvm-test-suite/tree/main/SingleSource/Benchmarks/Misc > (flops-4.c, flops-5.c, flops-6.c, flops-8.c, fp-convert.c). The numbers vary > depending on the microarchitecture, with Skylake being less affected (on the > order of ~10%) and AMD Rome showing larger regressions (up to 30%). FYI this patch saves ~3% instructions for some benchmarks from LLVM-test-suite on RISC-V. https://github.com/dtcxzyw/llvm-ci/issues/1115 https://github.com/dtcxzyw/llvm-ci/issues/1114 https://github.com/llvm/llvm-project/pull/82404 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [InstCombine] Canonicalize `(sitofp x)` -> `(uitofp x)` if `x >= 0` (PR #82404)
goldsteinn wrote: > Well, I'm not sure how proper that wold be as a reproducer, > > I extracted the mentioned test to a program: > > ``` > #include > > #include "third_party/swiftshader/src/Reactor/Coroutine.hpp" > #include "third_party/swiftshader/src/Reactor/Reactor.hpp" > > using float4 = float[4]; > using int4 = int[4]; > > static std::string testName() { return "test name"; } > > using namespace rr; > > int main() { > Function, Pointer)> function; > { > Pointer x = function.Arg<0>(); > Pointer y = function.Arg<1>(); > > *y = Abs(*x); > } > > auto routine = function(testName().c_str()); > auto callable = (void (*)(int4 *, int4 *))routine->getEntry(); > > int input[] = {1, -1, 0, (int)0x8000}; > > for (int x : input) { > int4 v_in = {x, x, x, x}; > int4 v_out = {0}; > > callable(&v_in, &v_out); > > float expected = abs(x); > if (v_out[0] != expected) { > return 10; > } > } > } > ``` > > Before the change program exits with 0, after it exists with 10. More > precisely: `v_out[0]` is: -2147483648, `expected` is: 2.14748365e+09 > > [out_at.txt](https://github.com/llvm/llvm-project/files/14670227/out_at.txt) > [out_before.txt](https://github.com/llvm/llvm-project/files/14670228/out_before.txt) > > I attached the generated IR before and after the change. It's only one line > diff: > > ``` >call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 > dereferenceable(16) %9, i8 0, i64 16, i1 false) >call void %49(ptr noundef nonnull %8, ptr noundef nonnull %9) #16 >%61 = call i32 @llvm.abs.i32(i32 %60, i1 true) > - %62 = sitofp i32 %61 to float > + %62 = uitofp i32 %61 to float >%63 = load i32, ptr %9, align 16 >%64 = sitofp i32 %63 to float >%65 = fcmp une float %64, %62 > ``` > > generation command is `clang -O1 -fsized-deallocation '-std=gnu++20' -c > pre.ii -emit-llvm -S -o /tmp/ir_before.ll` > > I'm trying to reduce the preprocessed file, tho not sure i'll keep the > semantics of the failure. This should be sufficient, thank you! https://github.com/llvm/llvm-project/pull/82404 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [InstCombine] Canonicalize `(sitofp x)` -> `(uitofp x)` if `x >= 0` (PR #82404)
asmok-g wrote: Well, I'm not sure how proper that wold be as a reproducer, I extracted the mentioned test to a program: ``` #include #include "third_party/swiftshader/src/Reactor/Coroutine.hpp" #include "third_party/swiftshader/src/Reactor/Reactor.hpp" using float4 = float[4]; using int4 = int[4]; static std::string testName() { return "test name"; } using namespace rr; int main() { Function, Pointer)> function; { Pointer x = function.Arg<0>(); Pointer y = function.Arg<1>(); *y = Abs(*x); } auto routine = function(testName().c_str()); auto callable = (void (*)(int4 *, int4 *))routine->getEntry(); int input[] = {1, -1, 0, (int)0x8000}; for (int x : input) { int4 v_in = {x, x, x, x}; int4 v_out = {0}; callable(&v_in, &v_out); float expected = abs(x); if (v_out[0] != expected) { return 10; } } } ``` Before the change program exits with 0, after it exists with 10. More precisely: `v_out[0]` is: -2147483648, `expected` is: 2.14748365e+09 [out_at.txt](https://github.com/llvm/llvm-project/files/14670227/out_at.txt) [out_before.txt](https://github.com/llvm/llvm-project/files/14670228/out_before.txt) I attached the generated IR before and after the change. It's only one line diff: ``` call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %9, i8 0, i64 16, i1 false) call void %49(ptr noundef nonnull %8, ptr noundef nonnull %9) #16 %61 = call i32 @llvm.abs.i32(i32 %60, i1 true) - %62 = sitofp i32 %61 to float + %62 = uitofp i32 %61 to float %63 = load i32, ptr %9, align 16 %64 = sitofp i32 %63 to float %65 = fcmp une float %64, %62 ``` generation command is `clang -O1 -fsized-deallocation '-std=gnu++20' -c pre.ii -emit-llvm -S -o /tmp/ir_before.ll` I'm trying to reduce the preprocessed file, tho not sure i'll keep the semantics of the failure. https://github.com/llvm/llvm-project/pull/82404 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [InstCombine] Canonicalize `(sitofp x)` -> `(uitofp x)` if `x >= 0` (PR #82404)
goldsteinn wrote: > Apart from the correctness issues, we've seen some regressions on various > benchmarks from LLVM Test Suite after this patch. Specifically, around 3-5% > regression on x86-64 in various metrics of the > [Interpolation](https://github.com/llvm/llvm-test-suite/tree/main/MicroBenchmarks/ImageProcessing/Interpolation) > benchmarks, and up to 30% regression on a number of floating point-centric > benchmarks from > https://github.com/llvm/llvm-test-suite/tree/main/SingleSource/Benchmarks/Misc > (flops-4.c, flops-5.c, flops-6.c, flops-8.c, fp-convert.c). The numbers vary > depending on the microarchitecture, with Skylake being less affected (on the > order of ~10%) and AMD Rome showing larger regressions (up to 30%). Thank you for the info, well its reverted now so nothing todo. Although that does motivate me to get re-post with the `nneg` flag support as it sounds like getting the right cast can be important and that will allow us to do a better job than we currently are. https://github.com/llvm/llvm-project/pull/82404 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [InstCombine] Canonicalize `(sitofp x)` -> `(uitofp x)` if `x >= 0` (PR #82404)
alexfh wrote: Apart from the correctness issues, we've seen some regressions on various benchmarks from LLVM Test Suite after this patch. Specifically, around 3-5% regression on x86-64 in various metrics of the [Interpolation](https://github.com/llvm/llvm-test-suite/tree/main/MicroBenchmarks/ImageProcessing/Interpolation) benchmarks, and up to 30% regression on a number of floating point-centric benchmarks from https://github.com/llvm/llvm-test-suite/tree/main/SingleSource/Benchmarks/Misc (flops-4.c, flops-5.c, flops-6.c, flops-8.c, fp-convert.c). The numbers vary depending on the microarchitecture, with Skylake being less affected (on the order of ~10%) and AMD Rome showing larger regressions (up to 30%). https://github.com/llvm/llvm-project/pull/82404 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [InstCombine] Canonicalize `(sitofp x)` -> `(uitofp x)` if `x >= 0` (PR #82404)
goldsteinn wrote: > Heads up: we noticed at google that this is causing the following test to > fail: > > https://github.com/google/swiftshader/blob/master/tests/ReactorUnitTests/ReactorUnitTests.cpp#L1312 > > I need to put a more proper reproducer, but thought that at least posting the > heads-up might be faster to unblock us and maybe the problem is clear. I see > that adding a flag vs reverting is already brought up in the last comment, > what's the plan for that ? Reverted with: https://github.com/llvm/llvm-project/commit/6960ace534c4021301dd5a9933ca06ba96edea23 If you can get the repro though, that would still be useful for when I revisit. https://github.com/llvm/llvm-project/pull/82404 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [InstCombine] Canonicalize `(sitofp x)` -> `(uitofp x)` if `x >= 0` (PR #82404)
goldsteinn wrote: Ill revert this. I'll re-post if I get around to adding a flag. Any chance you can still create a repro of the bug your seeing for if I re-post? https://github.com/llvm/llvm-project/pull/82404 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [InstCombine] Canonicalize `(sitofp x)` -> `(uitofp x)` if `x >= 0` (PR #82404)
asmok-g wrote: Heads up: we noticed at google that this is causing the following test to fail: https://github.com/google/swiftshader/blob/master/tests/ReactorUnitTests/ReactorUnitTests.cpp#L1312 I need to put a more proper reproducer, but thought that at least posting the heads-up might be faster to unblock us and maybe the problem is clear. I see that adding a flag vs reverting is already brought up in the last comment, what's the plan for that ? https://github.com/llvm/llvm-project/pull/82404 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [InstCombine] Canonicalize `(sitofp x)` -> `(uitofp x)` if `x >= 0` (PR #82404)
goldsteinn wrote: > I don't think we really have a strong motivation for this change beyond > "having a canonical form is usually good", so if it's causing issues for some > targets, then probably just not doing it is fine. But if we do want to keep > it, then yeah, this would be a reasonable motivation for adding the nneg flag. I don't have any strong preference. I think there is some value in this change so I'm slightly in favor of adding `nneg`. Letting the chips fall where they may, when some backends can have `ui` preference, doesn't really seem that great either. But, I have no problem reverting this if thats the sentiment of the room. https://github.com/llvm/llvm-project/pull/82404 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [InstCombine] Canonicalize `(sitofp x)` -> `(uitofp x)` if `x >= 0` (PR #82404)
nikic wrote: I don't think we really have a strong motivation for this change beyond "having a canonical form is usually good", so if it's causing issues for some targets, then probably just not doing it is fine. But if we do want to keep it, then yeah, this would be a reasonable motivation for adding the nneg flag. https://github.com/llvm/llvm-project/pull/82404 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [InstCombine] Canonicalize `(sitofp x)` -> `(uitofp x)` if `x >= 0` (PR #82404)
goldsteinn wrote: > We happen have a back-end where we do not have conversion instructions > between unsigned int and FP, so this patch complicates things. Would it make > sense to enable this canonicalization only if the target wants it? We try to keep InstCombine as target agnostic as possible so probably not. Thats why I was thinking of adding the `nneg` flag, so its extremely easy for the backend to undo this. If we don't go with `nneg` and its causing issues on a lot of targets, revert might be the right approach. https://github.com/llvm/llvm-project/pull/82404 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [InstCombine] Canonicalize `(sitofp x)` -> `(uitofp x)` if `x >= 0` (PR #82404)
Artem-B wrote: We happen have a back-end where we do not have conversion instructions between unsigned int and FP, so this patch complicates things. Would it make sense to enable this canonicalization only if the target wants it? https://github.com/llvm/llvm-project/pull/82404 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [InstCombine] Canonicalize `(sitofp x)` -> `(uitofp x)` if `x >= 0` (PR #82404)
https://github.com/goldsteinn closed https://github.com/llvm/llvm-project/pull/82404 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [InstCombine] Canonicalize `(sitofp x)` -> `(uitofp x)` if `x >= 0` (PR #82404)
nikic wrote: @goldsteinn Doesn't seem worthwhile. https://github.com/llvm/llvm-project/pull/82404 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [InstCombine] Canonicalize `(sitofp x)` -> `(uitofp x)` if `x >= 0` (PR #82404)
goldsteinn wrote: @nikic, what do you think about adding `nneg` for `uitofp`? https://github.com/llvm/llvm-project/pull/82404 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [InstCombine] Canonicalize `(sitofp x)` -> `(uitofp x)` if `x >= 0` (PR #82404)
https://github.com/nikic approved this pull request. https://github.com/llvm/llvm-project/pull/82404 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [InstCombine] Canonicalize `(sitofp x)` -> `(uitofp x)` if `x >= 0` (PR #82404)
goldsteinn wrote: ping https://github.com/llvm/llvm-project/pull/82404 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [InstCombine] Canonicalize `(sitofp x)` -> `(uitofp x)` if `x >= 0` (PR #82404)
goldsteinn wrote: > It looks like you need to update `Headers/__clang_hip_math.hip` in clang. Fixed. Thats what I get for not running clang tests :/ https://github.com/llvm/llvm-project/pull/82404 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [InstCombine] Canonicalize `(sitofp x)` -> `(uitofp x)` if `x >= 0` (PR #82404)
https://github.com/goldsteinn updated https://github.com/llvm/llvm-project/pull/82404 >From 08fddf10b8d78f5cf866dcb687009f20cfb85bd3 Mon Sep 17 00:00:00 2001 From: Noah Goldstein Date: Tue, 20 Feb 2024 12:51:02 -0600 Subject: [PATCH] [InstCombine] Canonicalize `(sitofp x)` -> `(uitofp x)` if `x >= 0` Just a standard canonicalization. Proofs: https://alive2.llvm.org/ce/z/9W4VFm --- clang/test/Headers/__clang_hip_math.hip | 24 .../InstCombine/InstCombineCasts.cpp | 6 +- .../test/Transforms/InstCombine/add-sitofp.ll | 10 ++-- .../Transforms/InstCombine/binop-itofp.ll | 28 +- .../Transforms/InstCombine/clamp-to-minmax.ll | 6 +- llvm/test/Transforms/InstCombine/fpcast.ll| 12 ++-- .../Transforms/InstCombine/minmax-fold.ll | 10 ++-- llvm/test/Transforms/InstCombine/minmax-fp.ll | 2 +- llvm/test/Transforms/InstCombine/pr27236.ll | 2 +- .../LoopVectorize/X86/float-induction-x86.ll | 6 +- .../LoopVectorize/float-induction.ll | 56 +-- 11 files changed, 83 insertions(+), 79 deletions(-) diff --git a/clang/test/Headers/__clang_hip_math.hip b/clang/test/Headers/__clang_hip_math.hip index 37099de74fb8ec..701f93853ab93c 100644 --- a/clang/test/Headers/__clang_hip_math.hip +++ b/clang/test/Headers/__clang_hip_math.hip @@ -1685,7 +1685,7 @@ extern "C" __device__ double test_j1(double x) { // DEFAULT-NEXT:[[__X1_0_I3:%.*]] = phi float [ [[SUB_I:%.*]], [[FOR_BODY_I]] ], [ [[CALL_I21_I]], [[IF_END4_I]] ] // DEFAULT-NEXT:[[__X0_0_I2:%.*]] = phi float [ [[__X1_0_I3]], [[FOR_BODY_I]] ], [ [[CALL_I_I]], [[IF_END4_I]] ] // DEFAULT-NEXT:[[MUL_I:%.*]] = shl nuw nsw i32 [[__I_0_I4]], 1 -// DEFAULT-NEXT:[[CONV_I:%.*]] = sitofp i32 [[MUL_I]] to float +// DEFAULT-NEXT:[[CONV_I:%.*]] = uitofp i32 [[MUL_I]] to float // DEFAULT-NEXT:[[DIV_I:%.*]] = fdiv contract float [[CONV_I]], [[Y]] // DEFAULT-NEXT:[[MUL8_I:%.*]] = fmul contract float [[__X1_0_I3]], [[DIV_I]] // DEFAULT-NEXT:[[SUB_I]] = fsub contract float [[MUL8_I]], [[__X0_0_I2]] @@ -1718,7 +1718,7 @@ extern "C" __device__ double test_j1(double x) { // FINITEONLY-NEXT:[[__X1_0_I3:%.*]] = phi float [ [[SUB_I:%.*]], [[FOR_BODY_I]] ], [ [[CALL_I21_I]], [[IF_END4_I]] ] // FINITEONLY-NEXT:[[__X0_0_I2:%.*]] = phi float [ [[__X1_0_I3]], [[FOR_BODY_I]] ], [ [[CALL_I_I]], [[IF_END4_I]] ] // FINITEONLY-NEXT:[[MUL_I:%.*]] = shl nuw nsw i32 [[__I_0_I4]], 1 -// FINITEONLY-NEXT:[[CONV_I:%.*]] = sitofp i32 [[MUL_I]] to float +// FINITEONLY-NEXT:[[CONV_I:%.*]] = uitofp i32 [[MUL_I]] to float // FINITEONLY-NEXT:[[DIV_I:%.*]] = fdiv nnan ninf contract float [[CONV_I]], [[Y]] // FINITEONLY-NEXT:[[MUL8_I:%.*]] = fmul nnan ninf contract float [[__X1_0_I3]], [[DIV_I]] // FINITEONLY-NEXT:[[SUB_I]] = fsub nnan ninf contract float [[MUL8_I]], [[__X0_0_I2]] @@ -1751,7 +1751,7 @@ extern "C" __device__ double test_j1(double x) { // APPROX-NEXT:[[__X1_0_I3:%.*]] = phi float [ [[SUB_I:%.*]], [[FOR_BODY_I]] ], [ [[CALL_I21_I]], [[IF_END4_I]] ] // APPROX-NEXT:[[__X0_0_I2:%.*]] = phi float [ [[__X1_0_I3]], [[FOR_BODY_I]] ], [ [[CALL_I_I]], [[IF_END4_I]] ] // APPROX-NEXT:[[MUL_I:%.*]] = shl nuw nsw i32 [[__I_0_I4]], 1 -// APPROX-NEXT:[[CONV_I:%.*]] = sitofp i32 [[MUL_I]] to float +// APPROX-NEXT:[[CONV_I:%.*]] = uitofp i32 [[MUL_I]] to float // APPROX-NEXT:[[DIV_I:%.*]] = fdiv contract float [[CONV_I]], [[Y]] // APPROX-NEXT:[[MUL8_I:%.*]] = fmul contract float [[__X1_0_I3]], [[DIV_I]] // APPROX-NEXT:[[SUB_I]] = fsub contract float [[MUL8_I]], [[__X0_0_I2]] @@ -1788,7 +1788,7 @@ extern "C" __device__ float test_jnf(int x, float y) { // DEFAULT-NEXT:[[__X1_0_I3:%.*]] = phi double [ [[SUB_I:%.*]], [[FOR_BODY_I]] ], [ [[CALL_I21_I]], [[IF_END4_I]] ] // DEFAULT-NEXT:[[__X0_0_I2:%.*]] = phi double [ [[__X1_0_I3]], [[FOR_BODY_I]] ], [ [[CALL_I_I]], [[IF_END4_I]] ] // DEFAULT-NEXT:[[MUL_I:%.*]] = shl nuw nsw i32 [[__I_0_I4]], 1 -// DEFAULT-NEXT:[[CONV_I:%.*]] = sitofp i32 [[MUL_I]] to double +// DEFAULT-NEXT:[[CONV_I:%.*]] = uitofp i32 [[MUL_I]] to double // DEFAULT-NEXT:[[DIV_I:%.*]] = fdiv contract double [[CONV_I]], [[Y]] // DEFAULT-NEXT:[[MUL8_I:%.*]] = fmul contract double [[__X1_0_I3]], [[DIV_I]] // DEFAULT-NEXT:[[SUB_I]] = fsub contract double [[MUL8_I]], [[__X0_0_I2]] @@ -1821,7 +1821,7 @@ extern "C" __device__ float test_jnf(int x, float y) { // FINITEONLY-NEXT:[[__X1_0_I3:%.*]] = phi double [ [[SUB_I:%.*]], [[FOR_BODY_I]] ], [ [[CALL_I21_I]], [[IF_END4_I]] ] // FINITEONLY-NEXT:[[__X0_0_I2:%.*]] = phi double [ [[__X1_0_I3]], [[FOR_BODY_I]] ], [ [[CALL_I_I]], [[IF_END4_I]] ] // FINITEONLY-NEXT:[[MUL_I:%.*]] = shl nuw nsw i32 [[__I_0_I4]], 1 -// FINITEONLY-NEXT:[[CONV_I:%.*]] = sitofp i32 [[MUL_I]] to double +// FINITEONLY-NEXT:[[CONV_I:%.*]] = uitofp i32 [[MUL_I]] to double // FINITEONLY-NEXT:[[DIV_I:%.*]] = fdiv nnan ninf contrac