diff options
author | Nikita Popov <npopov@redhat.com> | 2024-11-25 10:55:55 +0100 |
---|---|---|
committer | Nikita Popov <npopov@redhat.com> | 2024-11-25 10:56:24 +0100 |
commit | f81f47e3ff29598fdf58cde94ccf2c7d4be53df5 (patch) | |
tree | b473ba30afb5e2fa064f66d44d7000877ab4f056 | |
parent | c537c752787e9da8bd8762dd5298a152f546861b (diff) | |
download | llvm-f81f47e3ff29598fdf58cde94ccf2c7d4be53df5.zip llvm-f81f47e3ff29598fdf58cde94ccf2c7d4be53df5.tar.gz llvm-f81f47e3ff29598fdf58cde94ccf2c7d4be53df5.tar.bz2 |
[InstCombine] Add fptrunc of max test (NFC)
To guard against regression from #117182.
-rw-r--r-- | llvm/test/Transforms/InstCombine/fptrunc.ll | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/fptrunc.ll b/llvm/test/Transforms/InstCombine/fptrunc.ll index f46940f..a4296a3 100644 --- a/llvm/test/Transforms/InstCombine/fptrunc.ll +++ b/llvm/test/Transforms/InstCombine/fptrunc.ll @@ -90,6 +90,19 @@ define half @fptrunc_select_true_val_extra_use(half %x, float %y, i1 %cond) { ret half %r } +define half @fptrunc_max(half %arg) { +; CHECK-LABEL: @fptrunc_max( +; CHECK-NEXT: [[CMP:%.*]] = fcmp olt half [[ARG:%.*]], 0xH0000 +; CHECK-NEXT: [[NARROW_SEL:%.*]] = select i1 [[CMP]], half 0xH0000, half [[ARG]] +; CHECK-NEXT: ret half [[NARROW_SEL]] +; + %ext = fpext half %arg to double + %cmp = fcmp olt double %ext, 0.000000e+00 + %max = select i1 %cmp, double 0.000000e+00, double %ext + %trunc = fptrunc double %max to half + ret half %trunc +} + ; Negative test - this would require an extra instruction. define half @fptrunc_select_true_val_extra_use_2(half %x, float %y, i1 %cond) { |