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
; RUN: llc < %s -O0 -mtriple=i686--
; RUN: llc < %s -O0 -mtriple=x86_64--
; RUN: llc < %s -O2 -mtriple=i686--
; RUN: llc < %s -O2 -mtriple=x86_64--


; Test big index trunc to pointer size:

define i8* @test_trunc65(i8* %ptr) nounwind {
; CHECK-LABEL: test_trunc65
; CHECK: 3
  %d = getelementptr i8, i8* %ptr, i65 18446744073709551619 ; 2^64 + 3
  ret i8* %d
}

define i8* @test_trunc128(i8* %ptr) nounwind {
; CHECK-LABEL: test_trunc128
; CHECK: 5
  %d = getelementptr i8, i8* %ptr, i128 18446744073709551621 ; 2^64 + 5
  ret i8* %d
}

define i8* @test_trunc160(i8* %ptr) nounwind {
; CHECK-LABEL: test_trunc160
; CHECK: 8
  %d = getelementptr i8, i8* %ptr, i160 18446744073709551624 ; 2^64 + 8
  ret i8* %d
}

define i8* @test_trunc256(i8* %ptr) nounwind {
; CHECK-LABEL: test_trunc256
; CHECK: 13
  %d = getelementptr i8, i8* %ptr, i256 18446744073709551629 ; 2^64 + 13
  ret i8* %d
}

define i8* @test_trunc2048(i8* %ptr) nounwind {
; CHECK-LABEL: test_trunc2048
; CHECK: 21
  %d = getelementptr i8, i8* %ptr, i2048 18446744073709551637 ; 2^64 + 21
  ret i8* %d
}


; Test small index sext to pointer size

define i8* @test_sext3(i8* %ptr) nounwind {
; CHECK-LABEL: test_sext3
; CHECK: -3
  %d = getelementptr i8, i8* %ptr, i3 -3
  ret i8* %d
}

define i8* @test_sext5(i8* %ptr) nounwind {
; CHECK-LABEL: test_sext5
; CHECK: -5
  %d = getelementptr i8, i8* %ptr, i5 -5
  ret i8* %d
}

define i8* @test_sext8(i8* %ptr) nounwind {
; CHECK-LABEL: test_sext8
; CHECK: -8
  %d = getelementptr i8, i8* %ptr, i8 -8
  ret i8* %d
}

define i8* @test_sext13(i8* %ptr) nounwind {
; CHECK-LABEL: test_sext13
; CHECK: -13
  %d = getelementptr i8, i8* %ptr, i8 -13
  ret i8* %d
}

define i8* @test_sext16(i8* %ptr) nounwind {
; CHECK-LABEL: test_sext16
; CHECK: -21
  %d = getelementptr i8, i8* %ptr, i8 -21
  ret i8* %d
}


; Test out of int64_t range indices

; OSS-Fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7173
define void @test_outofrange(i96* %ptr) nounwind {
; CHECK-LABEL: test_outofrange
  %d = getelementptr i96, i96* %ptr, i96 39614081257132168796771975167
  %ld = load i96, i96* %d, align 1
  unreachable
}