| ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6 | |
| ; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -passes=slp-vectorizer < %s | FileCheck -check-prefixes=NOPACKED %s | |
| ; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -mcpu=gfx90a -passes=slp-vectorizer < %s | FileCheck -check-prefixes=PACKED,GFX90A %s | |
| ; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -mcpu=gfx950 -passes=slp-vectorizer < %s | FileCheck -check-prefixes=PACKED,GFX950 %s | |
| ; A bitcast from i32 to float is a no-op, so it gives no saving when it is | |
| ; vectorized. | |
| ; Only the bitcasts feed the stored pair. A vector bitcast saves nothing over | |
| ; two scalar bitcasts. | |
| define void @bitcast_only(i32 %a, i32 %b, ptr addrspace(3) %out) { | |
| ; NOPACKED-LABEL: define void @bitcast_only( | |
| ; NOPACKED-SAME: i32 [[A:%.*]], i32 [[B:%.*]], ptr addrspace(3) [[OUT:%.*]]) #[[ATTR0:[0-9]+]] { | |
| ; NOPACKED-NEXT: [[AF:%.*]] = bitcast i32 [[A]] to float | |
| ; NOPACKED-NEXT: [[BF:%.*]] = bitcast i32 [[B]] to float | |
| ; NOPACKED-NEXT: [[R0:%.*]] = insertelement <2 x float> poison, float [[AF]], i64 0 | |
| ; NOPACKED-NEXT: [[R1:%.*]] = insertelement <2 x float> [[R0]], float [[BF]], i64 1 | |
| ; NOPACKED-NEXT: store <2 x float> [[R1]], ptr addrspace(3) [[OUT]], align 8 | |
| ; NOPACKED-NEXT: ret void | |
| ; | |
| ; PACKED-LABEL: define void @bitcast_only( | |
| ; PACKED-SAME: i32 [[A:%.*]], i32 [[B:%.*]], ptr addrspace(3) [[OUT:%.*]]) #[[ATTR0:[0-9]+]] { | |
| ; PACKED-NEXT: [[TMP1:%.*]] = insertelement <2 x i32> poison, i32 [[A]], i64 0 | |
| ; PACKED-NEXT: [[TMP2:%.*]] = insertelement <2 x i32> [[TMP1]], i32 [[B]], i64 1 | |
| ; PACKED-NEXT: [[TMP3:%.*]] = bitcast <2 x i32> [[TMP2]] to <2 x float> | |
| ; PACKED-NEXT: store <2 x float> [[TMP3]], ptr addrspace(3) [[OUT]], align 8 | |
| ; PACKED-NEXT: ret void | |
| ; | |
| %af = bitcast i32 %a to float | |
| %bf = bitcast i32 %b to float | |
| %r0 = insertelement <2 x float> poison, float %af, i64 0 | |
| %r1 = insertelement <2 x float> %r0, float %bf, i64 1 | |
| store <2 x float> %r1, ptr addrspace(3) %out, align 8 | |
| ret void | |
| } | |
| ; The fmul pair is a packed fmul, so the pair is still vectorized. | |
| define void @bitcast_fmul(i32 %a, i32 %b, float %x, float %y, ptr addrspace(3) %out) { | |
| ; NOPACKED-LABEL: define void @bitcast_fmul( | |
| ; NOPACKED-SAME: i32 [[A:%.*]], i32 [[B:%.*]], float [[X:%.*]], float [[Y:%.*]], ptr addrspace(3) [[OUT:%.*]]) #[[ATTR0]] { | |
| ; NOPACKED-NEXT: [[AF:%.*]] = bitcast i32 [[A]] to float | |
| ; NOPACKED-NEXT: [[BF:%.*]] = bitcast i32 [[B]] to float | |
| ; NOPACKED-NEXT: [[M0:%.*]] = fmul float [[AF]], [[X]] | |
| ; NOPACKED-NEXT: [[M1:%.*]] = fmul float [[BF]], [[Y]] | |
| ; NOPACKED-NEXT: [[R0:%.*]] = insertelement <2 x float> poison, float [[M0]], i64 0 | |
| ; NOPACKED-NEXT: [[R1:%.*]] = insertelement <2 x float> [[R0]], float [[M1]], i64 1 | |
| ; NOPACKED-NEXT: store <2 x float> [[R1]], ptr addrspace(3) [[OUT]], align 8 | |
| ; NOPACKED-NEXT: ret void | |
| ; | |
| ; PACKED-LABEL: define void @bitcast_fmul( | |
| ; PACKED-SAME: i32 [[A:%.*]], i32 [[B:%.*]], float [[X:%.*]], float [[Y:%.*]], ptr addrspace(3) [[OUT:%.*]]) #[[ATTR0]] { | |
| ; PACKED-NEXT: [[TMP1:%.*]] = insertelement <2 x i32> poison, i32 [[A]], i64 0 | |
| ; PACKED-NEXT: [[TMP2:%.*]] = insertelement <2 x i32> [[TMP1]], i32 [[B]], i64 1 | |
| ; PACKED-NEXT: [[TMP3:%.*]] = bitcast <2 x i32> [[TMP2]] to <2 x float> | |
| ; PACKED-NEXT: [[TMP4:%.*]] = insertelement <2 x float> poison, float [[X]], i64 0 | |
| ; PACKED-NEXT: [[TMP5:%.*]] = insertelement <2 x float> [[TMP4]], float [[Y]], i64 1 | |
| ; PACKED-NEXT: [[TMP6:%.*]] = fmul <2 x float> [[TMP3]], [[TMP5]] | |
| ; PACKED-NEXT: store <2 x float> [[TMP6]], ptr addrspace(3) [[OUT]], align 8 | |
| ; PACKED-NEXT: ret void | |
| ; | |
| %af = bitcast i32 %a to float | |
| %bf = bitcast i32 %b to float | |
| %m0 = fmul float %af, %x | |
| %m1 = fmul float %bf, %y | |
| %r0 = insertelement <2 x float> poison, float %m0, i64 0 | |
| %r1 = insertelement <2 x float> %r0, float %m1, i64 1 | |
| store <2 x float> %r1, ptr addrspace(3) %out, align 8 | |
| ret void | |
| } | |
| ;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: | |
| ; GFX90A: {{.*}} | |
| ; GFX950: {{.*}} |