File: geps-128-bit-pointers.ll

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-proposed-updates
  • size: 1,998,492 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (53 lines) | stat: -rw-r--r-- 2,337 bytes parent folder | download | duplicates (12)
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
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -passes=constraint-elimination -S %s | FileCheck %s

target datalayout = "p:128:64"

; Test for 128 bit pointers. At the moment, constraints only support signed i64 offsets.
define i1 @gep_decomp_large_index_63_bits(ptr %a) {
; CHECK-LABEL: @gep_decomp_large_index_63_bits(
; CHECK-NEXT:  entry:
; CHECK-NEXT:    [[GEP_1:%.*]] = getelementptr inbounds i64, ptr [[A:%.*]], i64 9223372036854775804
; CHECK-NEXT:    [[GEP_2:%.*]] = getelementptr inbounds i64, ptr [[A]], i64 9223372036854775805
; CHECK-NEXT:    [[NE:%.*]] = icmp ne ptr [[GEP_1]], [[GEP_2]]
; CHECK-NEXT:    call void @llvm.assume(i1 [[NE]])
; CHECK-NEXT:    [[CMP_ULE:%.*]] = icmp ule ptr [[GEP_1]], [[GEP_2]]
; CHECK-NEXT:    [[CMP_UGE:%.*]] = icmp uge ptr [[GEP_1]], [[GEP_2]]
; CHECK-NEXT:    [[RES:%.*]] = xor i1 [[CMP_ULE]], [[CMP_ULE]]
; CHECK-NEXT:    ret i1 [[RES]]
;
entry:
  %gep.1 = getelementptr inbounds i64, ptr %a, i64 9223372036854775804
  %gep.2 = getelementptr inbounds i64, ptr %a, i64 9223372036854775805
  %ne = icmp ne ptr %gep.1, %gep.2
  call void @llvm.assume(i1 %ne)
  %cmp.ule = icmp ule ptr %gep.1, %gep.2
  %cmp.uge = icmp uge ptr %gep.1, %gep.2
  %res = xor i1 %cmp.ule, %cmp.ule
  ret i1 %res
}

define i1 @gep_decomp_large_index_67_bits(ptr %a) {
; CHECK-LABEL: @gep_decomp_large_index_67_bits(
; CHECK-NEXT:  entry:
; CHECK-NEXT:    [[GEP_1:%.*]] = getelementptr inbounds i64, ptr [[A:%.*]], i128 147573952589676412928
; CHECK-NEXT:    [[GEP_2:%.*]] = getelementptr inbounds i64, ptr [[A]], i128 147573952589676412929
; CHECK-NEXT:    [[NE:%.*]] = icmp ne ptr [[GEP_1]], [[GEP_2]]
; CHECK-NEXT:    call void @llvm.assume(i1 [[NE]])
; CHECK-NEXT:    [[CMP_ULE:%.*]] = icmp ule ptr [[GEP_1]], [[GEP_2]]
; CHECK-NEXT:    [[CMP_UGE:%.*]] = icmp uge ptr [[GEP_1]], [[GEP_2]]
; CHECK-NEXT:    [[RES:%.*]] = xor i1 [[CMP_ULE]], [[CMP_UGE]]
; CHECK-NEXT:    ret i1 [[RES]]
;
entry:
  %gep.1 = getelementptr inbounds i64, ptr %a, i128 147573952589676412928
  %gep.2 = getelementptr inbounds i64, ptr %a, i128 147573952589676412929
  %ne = icmp ne ptr %gep.1, %gep.2
  call void @llvm.assume(i1 %ne)
  %cmp.ule = icmp ule ptr %gep.1, %gep.2
  %cmp.uge = icmp uge ptr %gep.1, %gep.2
  %res = xor i1 %cmp.ule, %cmp.uge
  ret i1 %res
}

declare void @llvm.assume(i1)