|
| 1 | +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --filter "call.*(frexp|modf)" --version 4 |
| 2 | +; RUN: opt < %s -mattr=+sve -vector-library=ArmPL -passes=inject-tli-mappings,loop-vectorize -force-vector-interleave=1 -prefer-predicate-over-epilogue=predicate-dont-vectorize -S | FileCheck %s |
| 3 | + |
| 4 | +target triple = "aarch64-unknown-linux-gnu" |
| 5 | + |
| 6 | +; TODO: add mappings for frexp/frexpf |
| 7 | + |
| 8 | +define void @frexp_f64(ptr %in, ptr %out1, ptr %out2, i32 %N) { |
| 9 | +; CHECK-LABEL: define void @frexp_f64( |
| 10 | +; CHECK-SAME: ptr [[IN:%.*]], ptr [[OUT1:%.*]], ptr [[OUT2:%.*]], i32 [[N:%.*]]) #[[ATTR0:[0-9]+]] { |
| 11 | +; CHECK: [[CALL:%.*]] = tail call double @frexp(double noundef [[TMP0:%.*]], ptr noundef [[ADD_PTR:%.*]]) |
| 12 | +; |
| 13 | +entry: |
| 14 | + %cmp4 = icmp sgt i32 %N, 0 |
| 15 | + br i1 %cmp4, label %for.body.preheader, label %for.cond.cleanup |
| 16 | + |
| 17 | +for.body.preheader: |
| 18 | + %wide.trip.count = zext nneg i32 %N to i64 |
| 19 | + br label %for.body |
| 20 | + |
| 21 | +for.cond.cleanup: |
| 22 | + ret void |
| 23 | + |
| 24 | +for.body: |
| 25 | + %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ] |
| 26 | + %arrayidx = getelementptr inbounds double, ptr %in, i64 %indvars.iv |
| 27 | + %0 = load double, ptr %arrayidx, align 8 |
| 28 | + %add.ptr = getelementptr inbounds i32, ptr %out2, i64 %indvars.iv |
| 29 | + %call = tail call double @frexp(double noundef %0, ptr noundef %add.ptr) |
| 30 | + store double %call, ptr %out1, align 8 |
| 31 | + %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 |
| 32 | + %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count |
| 33 | + br i1 %exitcond.not, label %for.cond.cleanup, label %for.body |
| 34 | +} |
| 35 | + |
| 36 | +declare double @frexp(double, ptr) #1 |
| 37 | + |
| 38 | +define void @frexp_f32(ptr readonly %in, ptr %out1, ptr %out2, i32 %N) { |
| 39 | +; CHECK-LABEL: define void @frexp_f32( |
| 40 | +; CHECK-SAME: ptr readonly [[IN:%.*]], ptr [[OUT1:%.*]], ptr [[OUT2:%.*]], i32 [[N:%.*]]) #[[ATTR0]] { |
| 41 | +; CHECK: [[CALL:%.*]] = tail call float @frexpf(float noundef [[TMP0:%.*]], ptr noundef [[ADD_PTR:%.*]]) |
| 42 | +; |
| 43 | +entry: |
| 44 | + %cmp4 = icmp sgt i32 %N, 0 |
| 45 | + br i1 %cmp4, label %for.body.preheader, label %for.cond.cleanup |
| 46 | + |
| 47 | +for.body.preheader: |
| 48 | + %wide.trip.count = zext nneg i32 %N to i64 |
| 49 | + br label %for.body |
| 50 | + |
| 51 | +for.cond.cleanup: |
| 52 | + ret void |
| 53 | + |
| 54 | +for.body: |
| 55 | + %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ] |
| 56 | + %arrayidx = getelementptr inbounds float, ptr %in, i64 %indvars.iv |
| 57 | + %0 = load float, ptr %arrayidx, align 4 |
| 58 | + %add.ptr = getelementptr inbounds i32, ptr %out2, i64 %indvars.iv |
| 59 | + %call = tail call float @frexpf(float noundef %0, ptr noundef %add.ptr) |
| 60 | + store float %call, ptr %out1, align 4 |
| 61 | + %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 |
| 62 | + %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count |
| 63 | + br i1 %exitcond.not, label %for.cond.cleanup, label %for.body |
| 64 | +} |
| 65 | + |
| 66 | +declare float @frexpf(float , ptr) #1 |
| 67 | + |
| 68 | +define void @modf_f64(ptr %in, ptr %out1, ptr %out2, i32 %N) { |
| 69 | +; CHECK-LABEL: define void @modf_f64( |
| 70 | +; CHECK-SAME: ptr [[IN:%.*]], ptr [[OUT1:%.*]], ptr [[OUT2:%.*]], i32 [[N:%.*]]) #[[ATTR0]] { |
| 71 | +; CHECK: [[TMP27:%.*]] = call <vscale x 2 x double> @armpl_svmodf_f64_x(<vscale x 2 x double> [[WIDE_MASKED_LOAD:%.*]], ptr [[TMP26:%.*]], <vscale x 2 x i1> [[ACTIVE_LANE_MASK:%.*]]) |
| 72 | +; CHECK: [[CALL:%.*]] = tail call double @modf(double noundef [[TMP32:%.*]], ptr noundef [[ADD_PTR:%.*]]) #[[ATTR5:[0-9]+]] |
| 73 | +; |
| 74 | +entry: |
| 75 | + %cmp7 = icmp sgt i32 %N, 0 |
| 76 | + br i1 %cmp7, label %for.body.preheader, label %for.cond.cleanup |
| 77 | + |
| 78 | +for.body.preheader: |
| 79 | + %wide.trip.count = zext nneg i32 %N to i64 |
| 80 | + br label %for.body |
| 81 | + |
| 82 | +for.cond.cleanup: |
| 83 | + ret void |
| 84 | + |
| 85 | +for.body: |
| 86 | + %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ] |
| 87 | + %arrayidx = getelementptr inbounds double, ptr %in, i64 %indvars.iv |
| 88 | + %0 = load double, ptr %arrayidx, align 8 |
| 89 | + %add.ptr = getelementptr inbounds double, ptr %out2, i64 %indvars.iv |
| 90 | + %call = tail call double @modf(double noundef %0, ptr noundef %add.ptr) |
| 91 | + %arrayidx2 = getelementptr inbounds double, ptr %out1, i64 %indvars.iv |
| 92 | + store double %call, ptr %arrayidx2, align 8 |
| 93 | + %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 |
| 94 | + %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count |
| 95 | + br i1 %exitcond.not, label %for.cond.cleanup, label %for.body |
| 96 | +} |
| 97 | + |
| 98 | +declare double @modf(double , ptr ) #1 |
| 99 | + |
| 100 | +define void @modf_f32(ptr %in, ptr %out1, ptr %out2, i32 %N) { |
| 101 | +; CHECK-LABEL: define void @modf_f32( |
| 102 | +; CHECK-SAME: ptr [[IN:%.*]], ptr [[OUT1:%.*]], ptr [[OUT2:%.*]], i32 [[N:%.*]]) #[[ATTR0]] { |
| 103 | +; CHECK: [[TMP27:%.*]] = call <vscale x 4 x float> @armpl_svmodf_f32_x(<vscale x 4 x float> [[WIDE_MASKED_LOAD:%.*]], ptr [[TMP26:%.*]], <vscale x 4 x i1> [[ACTIVE_LANE_MASK:%.*]]) |
| 104 | +; CHECK: [[CALL:%.*]] = tail call float @modff(float noundef [[TMP32:%.*]], ptr noundef [[ADD_PTR:%.*]]) #[[ATTR6:[0-9]+]] |
| 105 | +; |
| 106 | +entry: |
| 107 | + %cmp7 = icmp sgt i32 %N, 0 |
| 108 | + br i1 %cmp7, label %for.body.preheader, label %for.cond.cleanup |
| 109 | + |
| 110 | +for.body.preheader: |
| 111 | + %wide.trip.count = zext nneg i32 %N to i64 |
| 112 | + br label %for.body |
| 113 | + |
| 114 | +for.cond.cleanup: |
| 115 | + ret void |
| 116 | + |
| 117 | +for.body: |
| 118 | + %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ] |
| 119 | + %arrayidx = getelementptr inbounds float, ptr %in, i64 %indvars.iv |
| 120 | + %0 = load float, ptr %arrayidx, align 4 |
| 121 | + %add.ptr = getelementptr inbounds float, ptr %out2, i64 %indvars.iv |
| 122 | + %call = tail call float @modff(float noundef %0, ptr noundef %add.ptr) |
| 123 | + %arrayidx2 = getelementptr inbounds float, ptr %out1, i64 %indvars.iv |
| 124 | + store float %call, ptr %arrayidx2, align 4 |
| 125 | + %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 |
| 126 | + %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count |
| 127 | + br i1 %exitcond.not, label %for.cond.cleanup, label %for.body |
| 128 | +} |
| 129 | + |
| 130 | +declare float @modff(float noundef, ptr nocapture noundef) #1 |
| 131 | + |
| 132 | +attributes #1 = { memory(argmem: write) } |
0 commit comments