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
; Test the Test Data Class instruction, selected manually via the intrinsic.
;
; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s

declare i32 @llvm.s390.tdc.f32(float, i64)
declare i32 @llvm.s390.tdc.f64(double, i64)
declare i32 @llvm.s390.tdc.f128(fp128, i64)

; Check using as i32 - f32
define i32 @f1(float %x) {
; CHECK-LABEL: f1
; CHECK: tceb %f0, 123
; CHECK: ipm %r2
; CHECK: srl %r2, 28
  %res = call i32 @llvm.s390.tdc.f32(float %x, i64 123)
  ret i32 %res
}

; Check using as i32 - f64
define i32 @f2(double %x) {
; CHECK-LABEL: f2
; CHECK: tcdb %f0, 123
; CHECK: ipm %r2
; CHECK: srl %r2, 28
  %res = call i32 @llvm.s390.tdc.f64(double %x, i64 123)
  ret i32 %res
}

; Check using as i32 - f128
define i32 @f3(fp128 %x) {
; CHECK-LABEL: f3
; CHECK: ld %f0, 0(%r2)
; CHECK: ld %f2, 8(%r2)
; CHECK: tcxb %f0, 123
; CHECK: ipm %r2
; CHECK: srl %r2, 28
  %res = call i32 @llvm.s390.tdc.f128(fp128 %x, i64 123)
  ret i32 %res
}

declare void @g()

; Check branch
define void @f4(float %x) {
; CHECK-LABEL: f4
; CHECK: tceb %f0, 123
; CHECK: jgl g
; CHECK: br %r14
  %res = call i32 @llvm.s390.tdc.f32(float %x, i64 123)
  %cond = icmp ne i32 %res, 0
  br i1 %cond, label %call, label %exit

call:
  tail call void @g()
  br label %exit

exit:
  ret void
}

; Check branch negated
define void @f5(float %x) {
; CHECK-LABEL: f5
; CHECK: tceb %f0, 123
; CHECK: jge g
; CHECK: br %r14
  %res = call i32 @llvm.s390.tdc.f32(float %x, i64 123)
  %cond = icmp eq i32 %res, 0
  br i1 %cond, label %call, label %exit

call:
  tail call void @g()
  br label %exit

exit:
  ret void
}

; Check non-const mask
define void @f6(float %x, i64 %y) {
; CHECK-LABEL: f6
; CHECK: tceb %f0, 0(%r2)
; CHECK: jge g
; CHECK: br %r14
  %res = call i32 @llvm.s390.tdc.f32(float %x, i64 %y)
  %cond = icmp eq i32 %res, 0
  br i1 %cond, label %call, label %exit

call:
  tail call void @g()
  br label %exit

exit:
  ret void
}