1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=slp-vectorizer -S -mtriple=nvptx64-nvidia-cuda -mcpu=sm_70 | FileCheck %s
3 ; RUN: opt < %s -passes=slp-vectorizer -S -mtriple=nvptx64-nvidia-cuda -mcpu=sm_40 | FileCheck %s -check-prefix=NOVECTOR
5 define void @fusion(ptr noalias nocapture align 256 dereferenceable(19267584) %arg, ptr noalias nocapture readonly align 256 dereferenceable(19267584) %arg1, i32 %arg2, i32 %arg3) local_unnamed_addr #0 {
6 ; CHECK-LABEL: @fusion(
7 ; CHECK-NEXT: [[TMP:%.*]] = shl nuw nsw i32 [[ARG2:%.*]], 6
8 ; CHECK-NEXT: [[TMP4:%.*]] = or i32 [[TMP]], [[ARG3:%.*]]
9 ; CHECK-NEXT: [[TMP5:%.*]] = shl nuw nsw i32 [[TMP4]], 2
10 ; CHECK-NEXT: [[TMP6:%.*]] = zext i32 [[TMP5]] to i64
11 ; CHECK-NEXT: [[TMP11:%.*]] = getelementptr inbounds half, ptr [[ARG1:%.*]], i64 [[TMP6]]
12 ; CHECK-NEXT: [[TMP16:%.*]] = getelementptr inbounds half, ptr [[ARG:%.*]], i64 [[TMP6]]
13 ; CHECK-NEXT: [[TMP1:%.*]] = load <2 x half>, ptr [[TMP11]], align 8
14 ; CHECK-NEXT: [[TMP2:%.*]] = fmul fast <2 x half> [[TMP1]], splat (half 0xH5380)
15 ; CHECK-NEXT: [[TMP3:%.*]] = fadd fast <2 x half> [[TMP2]], splat (half 0xH57F0)
16 ; CHECK-NEXT: store <2 x half> [[TMP3]], ptr [[TMP16]], align 8
17 ; CHECK-NEXT: ret void
19 ; NOVECTOR-LABEL: @fusion(
20 ; NOVECTOR-NEXT: [[TMP:%.*]] = shl nuw nsw i32 [[ARG2:%.*]], 6
21 ; NOVECTOR-NEXT: [[TMP4:%.*]] = or i32 [[TMP]], [[ARG3:%.*]]
22 ; NOVECTOR-NEXT: [[TMP5:%.*]] = shl nuw nsw i32 [[TMP4]], 2
23 ; NOVECTOR-NEXT: [[TMP6:%.*]] = zext i32 [[TMP5]] to i64
24 ; NOVECTOR-NEXT: [[TMP7:%.*]] = or disjoint i64 [[TMP6]], 1
25 ; NOVECTOR-NEXT: [[TMP11:%.*]] = getelementptr inbounds half, ptr [[ARG1:%.*]], i64 [[TMP6]]
26 ; NOVECTOR-NEXT: [[TMP12:%.*]] = load half, ptr [[TMP11]], align 8
27 ; NOVECTOR-NEXT: [[TMP13:%.*]] = fmul fast half [[TMP12]], 0xH5380
28 ; NOVECTOR-NEXT: [[TMP14:%.*]] = fadd fast half [[TMP13]], 0xH57F0
29 ; NOVECTOR-NEXT: [[TMP16:%.*]] = getelementptr inbounds half, ptr [[ARG:%.*]], i64 [[TMP6]]
30 ; NOVECTOR-NEXT: store half [[TMP14]], ptr [[TMP16]], align 8
31 ; NOVECTOR-NEXT: [[TMP17:%.*]] = getelementptr inbounds half, ptr [[ARG1]], i64 [[TMP7]]
32 ; NOVECTOR-NEXT: [[TMP18:%.*]] = load half, ptr [[TMP17]], align 2
33 ; NOVECTOR-NEXT: [[TMP19:%.*]] = fmul fast half [[TMP18]], 0xH5380
34 ; NOVECTOR-NEXT: [[TMP20:%.*]] = fadd fast half [[TMP19]], 0xH57F0
35 ; NOVECTOR-NEXT: [[TMP21:%.*]] = getelementptr inbounds half, ptr [[ARG]], i64 [[TMP7]]
36 ; NOVECTOR-NEXT: store half [[TMP20]], ptr [[TMP21]], align 2
37 ; NOVECTOR-NEXT: ret void
39 %tmp = shl nuw nsw i32 %arg2, 6
40 %tmp4 = or i32 %tmp, %arg3
41 %tmp5 = shl nuw nsw i32 %tmp4, 2
42 %tmp6 = zext i32 %tmp5 to i64
43 %tmp7 = or disjoint i64 %tmp6, 1
44 %tmp11 = getelementptr inbounds half, ptr %arg1, i64 %tmp6
45 %tmp12 = load half, ptr %tmp11, align 8
46 %tmp13 = fmul fast half %tmp12, 0xH5380
47 %tmp14 = fadd fast half %tmp13, 0xH57F0
48 %tmp16 = getelementptr inbounds half, ptr %arg, i64 %tmp6
49 store half %tmp14, ptr %tmp16, align 8
50 %tmp17 = getelementptr inbounds half, ptr %arg1, i64 %tmp7
51 %tmp18 = load half, ptr %tmp17, align 2
52 %tmp19 = fmul fast half %tmp18, 0xH5380
53 %tmp20 = fadd fast half %tmp19, 0xH57F0
54 %tmp21 = getelementptr inbounds half, ptr %arg, i64 %tmp7
55 store half %tmp20, ptr %tmp21, align 2
59 attributes #0 = { nounwind }