Skip to content

Commit 7dd8e3d

Browse files
committed
[CostModel][X86] intrinsic-cost-kinds.ll - add fcopysign costs tests
1 parent 7267860 commit 7dd8e3d

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

llvm/test/Analysis/CostModel/X86/intrinsic-cost-kinds.ll

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ declare {<16 x i32>, <16 x i1>} @llvm.umul.with.overflow.v16i32(<16 x i32>, <16
1616
declare i32 @llvm.smax.i32(i32, i32)
1717
declare <16 x i32> @llvm.smax.v16i32(<16 x i32>, <16 x i32>)
1818

19+
declare float @llvm.copysign.f32(float, float)
20+
declare <16 x float> @llvm.copysign.v16f32(<16 x float>, <16 x float>)
21+
1922
declare float @llvm.fmuladd.f32(float, float, float)
2023
declare <16 x float> @llvm.fmuladd.v16f32(<16 x float>, <16 x float>, <16 x float>)
2124

@@ -97,6 +100,32 @@ define void @smax(i32 %a, i32 %b, <16 x i32> %va, <16 x i32> %vb) {
97100
ret void
98101
}
99102

103+
define void @fcopysign(float %a, float %b, <16 x float> %va, <16 x float> %vb) {
104+
; THRU-LABEL: 'fcopysign'
105+
; THRU-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %s = call float @llvm.copysign.f32(float %a, float %b)
106+
; THRU-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v = call <16 x float> @llvm.copysign.v16f32(<16 x float> %va, <16 x float> %vb)
107+
; THRU-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
108+
;
109+
; LATE-LABEL: 'fcopysign'
110+
; LATE-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %s = call float @llvm.copysign.f32(float %a, float %b)
111+
; LATE-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v = call <16 x float> @llvm.copysign.v16f32(<16 x float> %va, <16 x float> %vb)
112+
; LATE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
113+
;
114+
; SIZE-LABEL: 'fcopysign'
115+
; SIZE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %s = call float @llvm.copysign.f32(float %a, float %b)
116+
; SIZE-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v = call <16 x float> @llvm.copysign.v16f32(<16 x float> %va, <16 x float> %vb)
117+
; SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
118+
;
119+
; SIZE_LATE-LABEL: 'fcopysign'
120+
; SIZE_LATE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %s = call float @llvm.copysign.f32(float %a, float %b)
121+
; SIZE_LATE-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v = call <16 x float> @llvm.copysign.v16f32(<16 x float> %va, <16 x float> %vb)
122+
; SIZE_LATE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
123+
;
124+
%s = call float @llvm.copysign.f32(float %a, float %b)
125+
%v = call <16 x float> @llvm.copysign.v16f32(<16 x float> %va, <16 x float> %vb)
126+
ret void
127+
}
128+
100129
define void @fmuladd(float %a, float %b, float %c, <16 x float> %va, <16 x float> %vb, <16 x float> %vc) {
101130
; THRU-LABEL: 'fmuladd'
102131
; THRU-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %s = call float @llvm.fmuladd.f32(float %a, float %b, float %c)

0 commit comments

Comments
 (0)