llvm/llvm/test/CodeGen/AArch64/GlobalISel/prelegalizer-combiner-select-to-fminmax.mir

# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple aarch64 -mattr=+fullfp16 -run-pass=aarch64-prelegalizer-combiner -global-isel -verify-machineinstrs %s -o - | FileCheck %s
---
name:            test_s16
body:             |
  bb.0:
    liveins: $h0

    ; CHECK-LABEL: name: test_s16
    ; CHECK: liveins: $h0
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s16) = COPY $h0
    ; CHECK-NEXT: [[C:%[0-9]+]]:_(s16) = G_FCONSTANT half 0xH0000
    ; CHECK-NEXT: [[FMAXIMUM:%[0-9]+]]:_(s16) = G_FMAXIMUM [[COPY]], [[C]]
    ; CHECK-NEXT: $h0 = COPY [[FMAXIMUM]](s16)
    ; CHECK-NEXT: RET_ReallyLR implicit $h0
    %0:_(s16) = COPY $h0
    %1:_(s16) = G_FCONSTANT half 0xH0000
    %2:_(s1) = G_FCMP floatpred(olt), %0(s16), %1
    %3:_(s16) = G_SELECT %2(s1), %1, %0
    $h0 = COPY %3(s16)
    RET_ReallyLR implicit $h0

...
---
name:            test_s32
body:             |
  bb.0:
    liveins: $s0

    ; CHECK-LABEL: name: test_s32
    ; CHECK: liveins: $s0
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $s0
    ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_FCONSTANT float 0.000000e+00
    ; CHECK-NEXT: [[FMAXIMUM:%[0-9]+]]:_(s32) = G_FMAXIMUM [[COPY]], [[C]]
    ; CHECK-NEXT: $s0 = COPY [[FMAXIMUM]](s32)
    ; CHECK-NEXT: RET_ReallyLR implicit $s0
    %0:_(s32) = COPY $s0
    %1:_(s32) = G_FCONSTANT float 0.000000e+00
    %2:_(s1) = G_FCMP floatpred(olt), %0(s32), %1
    %3:_(s32) = G_SELECT %2(s1), %1, %0
    $s0 = COPY %3(s32)
    RET_ReallyLR implicit $s0

...
---
name:            test_s64
body:             |
  bb.0:
    liveins: $d0

    ; CHECK-LABEL: name: test_s64
    ; CHECK: liveins: $d0
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $d0
    ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_FCONSTANT double 0.000000e+00
    ; CHECK-NEXT: [[FMAXIMUM:%[0-9]+]]:_(s64) = G_FMAXIMUM [[COPY]], [[C]]
    ; CHECK-NEXT: $d0 = COPY [[FMAXIMUM]](s64)
    ; CHECK-NEXT: RET_ReallyLR implicit $d0
    %0:_(s64) = COPY $d0
    %1:_(s64) = G_FCONSTANT double 0.000000e+00
    %2:_(s1) = G_FCMP floatpred(olt), %0(s64), %1
    %3:_(s64) = G_SELECT %2(s1), %1, %0
    $d0 = COPY %3(s64)
    RET_ReallyLR implicit $d0

...
---
name:            test_s64_fmin
body:             |
  bb.0:
    liveins: $d0

    ; CHECK-LABEL: name: test_s64_fmin
    ; CHECK: liveins: $d0
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $d0
    ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_FCONSTANT double 0.000000e+00
    ; CHECK-NEXT: [[FMINIMUM:%[0-9]+]]:_(s64) = G_FMINIMUM [[COPY]], [[C]]
    ; CHECK-NEXT: $d0 = COPY [[FMINIMUM]](s64)
    ; CHECK-NEXT: RET_ReallyLR implicit $d0
    %0:_(s64) = COPY $d0
    %1:_(s64) = G_FCONSTANT double 0.000000e+00
    %2:_(s1) = G_FCMP floatpred(ogt), %0(s64), %1
    %3:_(s64) = G_SELECT %2(s1), %1, %0
    $d0 = COPY %3(s64)
    RET_ReallyLR implicit $d0

...
---
name:            test_v8s16
body:             |
  bb.0:
    liveins: $q0

    ; CHECK-LABEL: name: test_v8s16
    ; CHECK: liveins: $q0
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<8 x s16>) = COPY $q0
    ; CHECK-NEXT: [[C:%[0-9]+]]:_(s16) = G_FCONSTANT half 0xH0000
    ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<8 x s16>) = G_BUILD_VECTOR [[C]](s16), [[C]](s16), [[C]](s16), [[C]](s16), [[C]](s16), [[C]](s16), [[C]](s16), [[C]](s16)
    ; CHECK-NEXT: [[FMAXIMUM:%[0-9]+]]:_(<8 x s16>) = G_FMAXIMUM [[COPY]], [[BUILD_VECTOR]]
    ; CHECK-NEXT: $q0 = COPY [[FMAXIMUM]](<8 x s16>)
    ; CHECK-NEXT: RET_ReallyLR implicit $q0
    %0:_(<8 x s16>) = COPY $q0
    %2:_(s16) = G_FCONSTANT half 0xH0000
    %1:_(<8 x s16>) = G_BUILD_VECTOR %2(s16), %2(s16), %2(s16), %2(s16), %2(s16), %2(s16), %2(s16), %2(s16)
    %3:_(<8 x s1>) = G_FCMP floatpred(olt), %0(<8 x s16>), %1
    %4:_(<8 x s16>) = G_SELECT %3(<8 x s1>), %1, %0
    $q0 = COPY %4(<8 x s16>)
    RET_ReallyLR implicit $q0

...
---
name:            test_v4s32
body:             |
  bb.0:
    liveins: $q0

    ; CHECK-LABEL: name: test_v4s32
    ; CHECK: liveins: $q0
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<2 x s64>) = COPY $q0
    ; CHECK-NEXT: [[BITCAST:%[0-9]+]]:_(<4 x s32>) = G_BITCAST [[COPY]](<2 x s64>)
    ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_FCONSTANT float 0.000000e+00
    ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<4 x s32>) = G_BUILD_VECTOR [[C]](s32), [[C]](s32), [[C]](s32), [[C]](s32)
    ; CHECK-NEXT: [[FMAXIMUM:%[0-9]+]]:_(<4 x s32>) = G_FMAXIMUM [[BITCAST]], [[BUILD_VECTOR]]
    ; CHECK-NEXT: $q0 = COPY [[FMAXIMUM]](<4 x s32>)
    ; CHECK-NEXT: RET_ReallyLR implicit $q0
    %1:_(<2 x s64>) = COPY $q0
    %0:_(<4 x s32>) = G_BITCAST %1(<2 x s64>)
    %3:_(s32) = G_FCONSTANT float 0.000000e+00
    %2:_(<4 x s32>) = G_BUILD_VECTOR %3(s32), %3(s32), %3(s32), %3(s32)
    %4:_(<4 x s1>) = G_FCMP floatpred(olt), %0(<4 x s32>), %2
    %5:_(<4 x s32>) = G_SELECT %4(<4 x s1>), %2, %0
    $q0 = COPY %5(<4 x s32>)
    RET_ReallyLR implicit $q0

...
---
name:            test_v2s64
body:             |
  bb.0:
    liveins: $q0

    ; CHECK-LABEL: name: test_v2s64
    ; CHECK: liveins: $q0
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<2 x s64>) = COPY $q0
    ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_FCONSTANT double 0.000000e+00
    ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s64>) = G_BUILD_VECTOR [[C]](s64), [[C]](s64)
    ; CHECK-NEXT: [[FMAXIMUM:%[0-9]+]]:_(<2 x s64>) = G_FMAXIMUM [[COPY]], [[BUILD_VECTOR]]
    ; CHECK-NEXT: $q0 = COPY [[FMAXIMUM]](<2 x s64>)
    ; CHECK-NEXT: RET_ReallyLR implicit $q0
    %0:_(<2 x s64>) = COPY $q0
    %2:_(s64) = G_FCONSTANT double 0.000000e+00
    %1:_(<2 x s64>) = G_BUILD_VECTOR %2(s64), %2(s64)
    %3:_(<2 x s1>) = G_FCMP floatpred(olt), %0(<2 x s64>), %1
    %4:_(<2 x s64>) = G_SELECT %3(<2 x s1>), %1, %0
    $q0 = COPY %4(<2 x s64>)
    RET_ReallyLR implicit $q0

...
---
name:            test_v2s64_fmin
body:             |
  bb.0:
    liveins: $q0

    ; CHECK-LABEL: name: test_v2s64_fmin
    ; CHECK: liveins: $q0
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<2 x s64>) = COPY $q0
    ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_FCONSTANT double 0.000000e+00
    ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s64>) = G_BUILD_VECTOR [[C]](s64), [[C]](s64)
    ; CHECK-NEXT: [[FMINIMUM:%[0-9]+]]:_(<2 x s64>) = G_FMINIMUM [[COPY]], [[BUILD_VECTOR]]
    ; CHECK-NEXT: $q0 = COPY [[FMINIMUM]](<2 x s64>)
    ; CHECK-NEXT: RET_ReallyLR implicit $q0
    %0:_(<2 x s64>) = COPY $q0
    %2:_(s64) = G_FCONSTANT double 0.000000e+00
    %1:_(<2 x s64>) = G_BUILD_VECTOR %2(s64), %2(s64)
    %3:_(<2 x s1>) = G_FCMP floatpred(ogt), %0(<2 x s64>), %1
    %4:_(<2 x s64>) = G_SELECT %3(<2 x s1>), %1, %0
    $q0 = COPY %4(<2 x s64>)
    RET_ReallyLR implicit $q0

...