brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · a93257f Raw
33 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 52; RUN: opt < %s -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1200 -passes=separate-const-offset-from-gep -S | FileCheck %s3 4; Verify that we drop "nuw" from trunc.5define ptr @pr154116_nuw(ptr %p, i128 %i) {6; CHECK-LABEL: define ptr @pr154116_nuw(7; CHECK-SAME: ptr [[P:%.*]], i128 [[I:%.*]]) #[[ATTR0:[0-9]+]] {8; CHECK-NEXT:    [[TMP1:%.*]] = trunc i128 [[I]] to i649; CHECK-NEXT:    [[TMP2:%.*]] = getelementptr i32, ptr [[P]], i64 [[TMP1]]10; CHECK-NEXT:    [[ARRAYIDX2:%.*]] = getelementptr i8, ptr [[TMP2]], i64 8011; CHECK-NEXT:    ret ptr [[ARRAYIDX2]]12;13  %idx = add i128 %i, 2014  %idx.conv = trunc nuw i128 %idx to i6415  %arrayidx = getelementptr i32, ptr %p, i64 %idx.conv16  ret ptr %arrayidx17}18 19; Verify that we drop "nsw" from trunc.20define ptr @pr154116_nsw(ptr %p, i128 %i) {21; CHECK-LABEL: define ptr @pr154116_nsw(22; CHECK-SAME: ptr [[P:%.*]], i128 [[I:%.*]]) #[[ATTR0]] {23; CHECK-NEXT:    [[TMP1:%.*]] = trunc i128 [[I]] to i6424; CHECK-NEXT:    [[TMP2:%.*]] = getelementptr i32, ptr [[P]], i64 [[TMP1]]25; CHECK-NEXT:    [[ARRAYIDX2:%.*]] = getelementptr i8, ptr [[TMP2]], i64 426; CHECK-NEXT:    ret ptr [[ARRAYIDX2]]27;28  %idx = add i128 %i, 129  %idx.conv = trunc nsw i128 %idx to i6430  %arrayidx = getelementptr i32, ptr %p, i64 %idx.conv31  ret ptr %arrayidx32}33