brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.9 KiB · fc06866 Raw
102 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 22; RUN: opt -S -mtriple=riscv64 -mattr=+v -riscv-v-slp-max-vf=0 -passes=slp-vectorizer -pass-remarks-output=%t < %s | FileCheck %s3; RUN: FileCheck --input-file=%t --check-prefix=YAML %s4 5; Because all of these addresses are foldable, the scalar cost should be 0 when6; computing the pointers chain cost.7;8; TODO: These are currently costed as free the indices are all constants, but we9; should check if the constants are actually foldable10define void @f(ptr %dest, i64 %i) {11; CHECK-LABEL: define void @f12; CHECK-SAME: (ptr [[DEST:%.*]], i64 [[I:%.*]]) #[[ATTR0:[0-9]+]] {13; CHECK-NEXT:  entry:14; CHECK-NEXT:    [[P1:%.*]] = getelementptr i32, ptr [[DEST]], i32 015; CHECK-NEXT:    store <4 x i32> splat (i32 1), ptr [[P1]], align 416; CHECK-NEXT:    ret void17;18entry:19; YAML:      Pass:            slp-vectorizer20; YAML-NEXT: Name:            StoresVectorized21; YAML-NEXT: Function:        f22; YAML-NEXT: Args:23; YAML-NEXT:   - String:          'Stores SLP vectorized with cost '24; YAML-NEXT:   - Cost:            '-2'25; YAML-NEXT:   - String:          ' and with tree size '26; YAML-NEXT:   - TreeSize:        '2'27  %p1 = getelementptr i32, ptr %dest, i32 028  store i32 1, ptr %p129  %p2 = getelementptr i32, ptr %dest, i32 130  store i32 1, ptr %p231  %p3 = getelementptr i32, ptr %dest, i32 232  store i32 1, ptr %p333  %p4 = getelementptr i32, ptr %dest, i32 334  store i32 1, ptr %p435  ret void36}37 38; When computing the scalar pointers chain cost here, there is a cost of 1 for39; the base pointer, and the rest can be folded in, so the scalar cost should be40; 1.41;42; TODO: These are currently costed as free the indices are all constants, but we43; should check if the constants are actually foldable44define void @g(ptr %dest, i64 %i) {45; CHECK-LABEL: define void @g46; CHECK-SAME: (ptr [[DEST:%.*]], i64 [[I:%.*]]) #[[ATTR0]] {47; CHECK-NEXT:  entry:48; CHECK-NEXT:    [[P1:%.*]] = getelementptr i32, ptr [[DEST]], i32 204849; CHECK-NEXT:    store <4 x i32> splat (i32 1), ptr [[P1]], align 450; CHECK-NEXT:    ret void51;52entry:53; YAML:      Pass:            slp-vectorizer54; YAML-NEXT: Name:            StoresVectorized55; YAML-NEXT: Function:        g56; YAML-NEXT: Args:57; YAML-NEXT:   - String:          'Stores SLP vectorized with cost '58; YAML-NEXT:   - Cost:            '-2'59; YAML-NEXT:   - String:          ' and with tree size '60; YAML-NEXT:   - TreeSize:        '2'61  %p1 = getelementptr i32, ptr %dest, i32 204862  store i32 1, ptr %p163  %p2 = getelementptr i32, ptr %dest, i32 204964  store i32 1, ptr %p265  %p3 = getelementptr i32, ptr %dest, i32 205066  store i32 1, ptr %p367  %p4 = getelementptr i32, ptr %dest, i32 205168  store i32 1, ptr %p469  ret void70}71 72; When computing the scalar pointers chain cost here, there is a cost of73; 1 for the base pointer, and the rest can be folded in, so the scalar cost74; should be 1.75define void @h(ptr %dest, i32 %i) {76; CHECK-LABEL: define void @h77; CHECK-SAME: (ptr [[DEST:%.*]], i32 [[I:%.*]]) #[[ATTR0]] {78; CHECK-NEXT:  entry:79; CHECK-NEXT:    [[P1:%.*]] = getelementptr [4 x i32], ptr [[DEST]], i32 [[I]], i32 080; CHECK-NEXT:    store <4 x i32> splat (i32 1), ptr [[P1]], align 481; CHECK-NEXT:    ret void82;83entry:84; YAML:      Pass:            slp-vectorizer85; YAML-NEXT: Name:            StoresVectorized86; YAML-NEXT: Function:        h87; YAML-NEXT: Args:88; YAML-NEXT:   - String:          'Stores SLP vectorized with cost '89; YAML-NEXT:   - Cost:            '-2'90; YAML-NEXT:   - String:          ' and with tree size '91; YAML-NEXT:   - TreeSize:        '2'92  %p1 = getelementptr [4 x i32], ptr %dest, i32 %i, i32 093  store i32 1, ptr %p194  %p2 = getelementptr [4 x i32], ptr %dest, i32 %i, i32 195  store i32 1, ptr %p296  %p3 = getelementptr [4 x i32], ptr %dest, i32 %i, i32 297  store i32 1, ptr %p398  %p4 = getelementptr [4 x i32], ptr %dest, i32 %i, i32 399  store i32 1, ptr %p4100  ret void101}102