reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90
   91
   92
   93
   94
   95
   96
   97
   98
   99
  100
; RUN: llc -O3 -mtriple=armv8a-none-eabi -mattr=+fullfp16 -o - %s | FileCheck %s
; RUN: llc -O3 -mtriple=thumbv8a-none-eabi -mattr=+fullfp16 -arm-no-restrict-it -o - %s | FileCheck %s

; Require the vmul.f16 not to be predicated, because it's illegal to
; do so with fp16 instructions
define half @conditional_fmul_f16(half* %p) {
; CHECK-LABEL: conditional_fmul_f16:
; CHECK: vmul.f16
entry:
  %p1 = getelementptr half, half* %p, i32 1
  %a = load half, half* %p, align 2
  %threshold = load half, half* %p1, align 2
  %flag = fcmp ogt half %a, %threshold
  br i1 %flag, label %mul, label %out

mul:
  %p2 = getelementptr half, half* %p, i32 2
  %mult = load half, half* %p2, align 2
  %b = fmul half %a, %mult
  br label %out

out:
  %sel = phi half [ %a, %entry ], [ %b, %mul ]
  ret half %sel
}

; Expect that the corresponding vmul.f32 _will_ be predicated (to make
; sure the previous test is really testing something)
define float @conditional_fmul_f32(float* %p) {
; CHECK-LABEL: conditional_fmul_f32:
; CHECK: vmulgt.f32
entry:
  %p1 = getelementptr float, float* %p, i32 1
  %a = load float, float* %p, align 2
  %threshold = load float, float* %p1, align 2
  %flag = fcmp ogt float %a, %threshold
  br i1 %flag, label %mul, label %out

mul:
  %p2 = getelementptr float, float* %p, i32 2
  %mult = load float, float* %p2, align 2
  %b = fmul float %a, %mult
  br label %out

out:
  %sel = phi float [ %a, %entry ], [ %b, %mul ]
  ret float %sel
}

; Require the two comparisons to be done with unpredicated vcmp.f16
; instructions (again, it is illegal to predicate them)
define void @chained_comparisons_f16(half* %p) {
; CHECK-LABEL: chained_comparisons_f16:
; CHECK: vcmp.f16
; CHECK: vcmp.f16
entry:
  %p1 = getelementptr half, half* %p, i32 1

  %a = load half, half* %p, align 2
  %b = load half, half* %p1, align 2

  %aflag = fcmp oeq half %a, 0xH0000
  %bflag = fcmp oeq half %b, 0xH0000
  %flag = or i1 %aflag, %bflag
  br i1 %flag, label %call, label %out

call:
  call void @external_function()
  br label %out

out:
  ret void
}

; Again, do the corresponding test with 32-bit floats and check that
; the second comparison _is_ predicated on the result of the first.
define void @chained_comparisons_f32(float* %p) {
; CHECK-LABEL: chained_comparisons_f32:
; CHECK: vcmp.f32
; CHECK: vcmpne.f32
entry:
  %p1 = getelementptr float, float* %p, i32 1

  %a = load float, float* %p, align 2
  %b = load float, float* %p1, align 2

  %aflag = fcmp oeq float %a, 0x00000000
  %bflag = fcmp oeq float %b, 0x00000000
  %flag = or i1 %aflag, %bflag
  br i1 %flag, label %call, label %out

call:
  call void @external_function()
  br label %out

out:
  ret void
}

declare void @external_function()