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
  101
  102
  103
  104
  105
  106
  107
  108
  109
  110
  111
  112
  113
  114
  115
  116
  117
  118
  119
  120
  121
  122
  123
  124
  125
  126
  127
  128
  129
  130
  131
  132
  133
  134
  135
  136
  137
  138
  139
  140
  141
  142
  143
  144
  145
  146
  147
  148
  149
  150
  151
  152
  153
  154
  155
  156
  157
  158
; RUN: llc -verify-machineinstrs -o - %s -mtriple=aarch64-linux-gnu | FileCheck %s
; RUN: llc -global-isel -global-isel-abort=2 -pass-remarks-missed=gisel* -verify-machineinstrs -o - %s -mtriple=aarch64-linux-gnu | FileCheck %s --check-prefixes=FALLBACK,GISEL

@var32 = global i32 0
@var64 = global i64 0

; FALLBACK-NOT: remark{{.*}}rev_i32
define void @rev_i32() {
; CHECK-LABEL: rev_i32:
; GISEL-LABEL: rev_i32:
    %val0_tmp = load i32, i32* @var32
    %val1_tmp = call i32 @llvm.bswap.i32(i32 %val0_tmp)
; CHECK: rev	{{w[0-9]+}}, {{w[0-9]+}}
; GISEL: rev	{{w[0-9]+}}, {{w[0-9]+}}
    store volatile i32 %val1_tmp, i32* @var32
    ret void
}

; FALLBACK-NOT: remark{{.*}}rev_i64
define void @rev_i64() {
; CHECK-LABEL: rev_i64:
; GISEL-LABEL: rev_i64:
    %val0_tmp = load i64, i64* @var64
    %val1_tmp = call i64 @llvm.bswap.i64(i64 %val0_tmp)
; CHECK: rev	{{x[0-9]+}}, {{x[0-9]+}}
; GISEL: rev	{{x[0-9]+}}, {{x[0-9]+}}
    store volatile i64 %val1_tmp, i64* @var64
    ret void
}

define void @rev32_i64() {
; CHECK-LABEL: rev32_i64:
    %val0_tmp = load i64, i64* @var64
    %val1_tmp = shl i64 %val0_tmp, 32
    %val5_tmp = sub i64 64, 32
    %val2_tmp = lshr i64 %val0_tmp, %val5_tmp
    %val3_tmp = or i64 %val1_tmp, %val2_tmp
    %val4_tmp = call i64 @llvm.bswap.i64(i64 %val3_tmp)
; CHECK: rev32	{{x[0-9]+}}, {{x[0-9]+}}
    store volatile i64 %val4_tmp, i64* @var64
    ret void
}

define void @rev16_i32() {
; CHECK-LABEL: rev16_i32:
    %val0_tmp = load i32, i32* @var32
    %val1_tmp = shl i32 %val0_tmp, 16
    %val2_tmp = lshr i32 %val0_tmp, 16
    %val3_tmp = or i32 %val1_tmp, %val2_tmp
    %val4_tmp = call i32 @llvm.bswap.i32(i32 %val3_tmp)
; CHECK: rev16	{{w[0-9]+}}, {{w[0-9]+}}
    store volatile i32 %val4_tmp, i32* @var32
    ret void
}

define void @clz_zerodef_i32() {
; CHECK-LABEL: clz_zerodef_i32:
    %val0_tmp = load i32, i32* @var32
    %val4_tmp = call i32 @llvm.ctlz.i32(i32 %val0_tmp, i1 0)
; CHECK: clz	{{w[0-9]+}}, {{w[0-9]+}}
    store volatile i32 %val4_tmp, i32* @var32
    ret void
}

define void @clz_zerodef_i64() {
; CHECK-LABEL: clz_zerodef_i64:
    %val0_tmp = load i64, i64* @var64
    %val4_tmp = call i64 @llvm.ctlz.i64(i64 %val0_tmp, i1 0)
; CHECK: clz	{{x[0-9]+}}, {{x[0-9]+}}
    store volatile i64 %val4_tmp, i64* @var64
    ret void
}

define void @clz_zeroundef_i32() {
; CHECK-LABEL: clz_zeroundef_i32:
    %val0_tmp = load i32, i32* @var32
    %val4_tmp = call i32 @llvm.ctlz.i32(i32 %val0_tmp, i1 1)
; CHECK: clz	{{w[0-9]+}}, {{w[0-9]+}}
    store volatile i32 %val4_tmp, i32* @var32
    ret void
}

define void @clz_zeroundef_i64() {
; CHECK-LABEL: clz_zeroundef_i64:
    %val0_tmp = load i64, i64* @var64
    %val4_tmp = call i64 @llvm.ctlz.i64(i64 %val0_tmp, i1 1)
; CHECK: clz	{{x[0-9]+}}, {{x[0-9]+}}
    store volatile i64 %val4_tmp, i64* @var64
    ret void
}

define void @cttz_zerodef_i32() {
; CHECK-LABEL: cttz_zerodef_i32:
    %val0_tmp = load i32, i32* @var32
    %val4_tmp = call i32 @llvm.cttz.i32(i32 %val0_tmp, i1 0)
; CHECK: rbit   [[REVERSED:w[0-9]+]], {{w[0-9]+}}
; CHECK: clz	{{w[0-9]+}}, [[REVERSED]]
    store volatile i32 %val4_tmp, i32* @var32
    ret void
}

define void @cttz_zerodef_i64() {
; CHECK-LABEL: cttz_zerodef_i64:
    %val0_tmp = load i64, i64* @var64
    %val4_tmp = call i64 @llvm.cttz.i64(i64 %val0_tmp, i1 0)
; CHECK: rbit   [[REVERSED:x[0-9]+]], {{x[0-9]+}}
; CHECK: clz	{{x[0-9]+}}, [[REVERSED]]
    store volatile i64 %val4_tmp, i64* @var64
    ret void
}

define void @cttz_zeroundef_i32() {
; CHECK-LABEL: cttz_zeroundef_i32:
    %val0_tmp = load i32, i32* @var32
    %val4_tmp = call i32 @llvm.cttz.i32(i32 %val0_tmp, i1 1)
; CHECK: rbit   [[REVERSED:w[0-9]+]], {{w[0-9]+}}
; CHECK: clz	{{w[0-9]+}}, [[REVERSED]]
    store volatile i32 %val4_tmp, i32* @var32
    ret void
}

define void @cttz_zeroundef_i64() {
; CHECK-LABEL: cttz_zeroundef_i64:
    %val0_tmp = load i64, i64* @var64
    %val4_tmp = call i64 @llvm.cttz.i64(i64 %val0_tmp, i1 1)
; CHECK: rbit   [[REVERSED:x[0-9]+]], {{x[0-9]+}}
; CHECK: clz	{{x[0-9]+}}, [[REVERSED]]
    store volatile i64 %val4_tmp, i64* @var64
    ret void
}

; These two are just compilation tests really: the operation's set to Expand in
; ISelLowering.
define void @ctpop_i32() {
; CHECK-LABEL: ctpop_i32:
    %val0_tmp = load i32, i32* @var32
    %val4_tmp = call i32 @llvm.ctpop.i32(i32 %val0_tmp)
    store volatile i32 %val4_tmp, i32* @var32
    ret void
}

define void @ctpop_i64() {
; CHECK-LABEL: ctpop_i64:
    %val0_tmp = load i64, i64* @var64
    %val4_tmp = call i64 @llvm.ctpop.i64(i64 %val0_tmp)
    store volatile i64 %val4_tmp, i64* @var64
    ret void
}


declare i32 @llvm.bswap.i32(i32)
declare i64 @llvm.bswap.i64(i64)
declare i32  @llvm.ctlz.i32 (i32, i1)
declare i64  @llvm.ctlz.i64 (i64, i1)
declare i32  @llvm.cttz.i32 (i32, i1)
declare i64  @llvm.cttz.i64 (i64, i1)
declare i32  @llvm.ctpop.i32 (i32)
declare i64  @llvm.ctpop.i64 (i64)