|
3 | 3 |
|
4 | 4 | using System.Numerics;
|
5 | 5 | using System.Runtime.Intrinsics;
|
| 6 | +using System.Runtime.Intrinsics.X86; |
| 7 | +using Castle.Components.DictionaryAdapter; |
6 | 8 | using SixLabors.ImageSharp.PixelFormats.PixelBlenders;
|
7 | 9 | using SixLabors.ImageSharp.Tests.TestUtilities;
|
8 | 10 |
|
@@ -30,6 +32,11 @@ public void NormalBlendFunction(TestVector4 back, TestVector4 source, float amou
|
30 | 32 | [MemberData(nameof(NormalBlendFunctionData))]
|
31 | 33 | public void NormalBlendFunction256(TestVector4 back, TestVector4 source, float amount, TestVector4 expected)
|
32 | 34 | {
|
| 35 | + if (!Avx.IsSupported) |
| 36 | + { |
| 37 | + return; |
| 38 | + } |
| 39 | + |
33 | 40 | Vector256<float> back256 = Vector256.Create(back.X, back.Y, back.Z, back.W, back.X, back.Y, back.Z, back.W);
|
34 | 41 | Vector256<float> source256 = Vector256.Create(source.X, source.Y, source.Z, source.W, source.X, source.Y, source.Z, source.W);
|
35 | 42 |
|
@@ -57,6 +64,11 @@ public void MultiplyFunction(TestVector4 back, TestVector4 source, float amount,
|
57 | 64 | [MemberData(nameof(MultiplyFunctionData))]
|
58 | 65 | public void MultiplyFunction256(TestVector4 back, TestVector4 source, float amount, TestVector4 expected)
|
59 | 66 | {
|
| 67 | + if (!Avx.IsSupported) |
| 68 | + { |
| 69 | + return; |
| 70 | + } |
| 71 | + |
60 | 72 | Vector256<float> back256 = Vector256.Create(back.X, back.Y, back.Z, back.W, back.X, back.Y, back.Z, back.W);
|
61 | 73 | Vector256<float> source256 = Vector256.Create(source.X, source.Y, source.Z, source.W, source.X, source.Y, source.Z, source.W);
|
62 | 74 |
|
@@ -84,6 +96,11 @@ public void AddFunction(TestVector4 back, TestVector4 source, float amount, Test
|
84 | 96 | [MemberData(nameof(AddFunctionData))]
|
85 | 97 | public void AddFunction256(TestVector4 back, TestVector4 source, float amount, TestVector4 expected)
|
86 | 98 | {
|
| 99 | + if (!Avx.IsSupported) |
| 100 | + { |
| 101 | + return; |
| 102 | + } |
| 103 | + |
87 | 104 | Vector256<float> back256 = Vector256.Create(back.X, back.Y, back.Z, back.W, back.X, back.Y, back.Z, back.W);
|
88 | 105 | Vector256<float> source256 = Vector256.Create(source.X, source.Y, source.Z, source.W, source.X, source.Y, source.Z, source.W);
|
89 | 106 |
|
@@ -111,6 +128,11 @@ public void SubtractFunction(TestVector4 back, TestVector4 source, float amount,
|
111 | 128 | [MemberData(nameof(SubtractFunctionData))]
|
112 | 129 | public void SubtractFunction256(TestVector4 back, TestVector4 source, float amount, TestVector4 expected)
|
113 | 130 | {
|
| 131 | + if (!Avx.IsSupported) |
| 132 | + { |
| 133 | + return; |
| 134 | + } |
| 135 | + |
114 | 136 | Vector256<float> back256 = Vector256.Create(back.X, back.Y, back.Z, back.W, back.X, back.Y, back.Z, back.W);
|
115 | 137 | Vector256<float> source256 = Vector256.Create(source.X, source.Y, source.Z, source.W, source.X, source.Y, source.Z, source.W);
|
116 | 138 |
|
@@ -138,6 +160,11 @@ public void ScreenFunction(TestVector4 back, TestVector4 source, float amount, T
|
138 | 160 | [MemberData(nameof(ScreenFunctionData))]
|
139 | 161 | public void ScreenFunction256(TestVector4 back, TestVector4 source, float amount, TestVector4 expected)
|
140 | 162 | {
|
| 163 | + if (!Avx.IsSupported) |
| 164 | + { |
| 165 | + return; |
| 166 | + } |
| 167 | + |
141 | 168 | Vector256<float> back256 = Vector256.Create(back.X, back.Y, back.Z, back.W, back.X, back.Y, back.Z, back.W);
|
142 | 169 | Vector256<float> source256 = Vector256.Create(source.X, source.Y, source.Z, source.W, source.X, source.Y, source.Z, source.W);
|
143 | 170 |
|
@@ -165,6 +192,11 @@ public void DarkenFunction(TestVector4 back, TestVector4 source, float amount, T
|
165 | 192 | [MemberData(nameof(DarkenFunctionData))]
|
166 | 193 | public void DarkenFunction256(TestVector4 back, TestVector4 source, float amount, TestVector4 expected)
|
167 | 194 | {
|
| 195 | + if (!Avx.IsSupported) |
| 196 | + { |
| 197 | + return; |
| 198 | + } |
| 199 | + |
168 | 200 | Vector256<float> back256 = Vector256.Create(back.X, back.Y, back.Z, back.W, back.X, back.Y, back.Z, back.W);
|
169 | 201 | Vector256<float> source256 = Vector256.Create(source.X, source.Y, source.Z, source.W, source.X, source.Y, source.Z, source.W);
|
170 | 202 |
|
@@ -192,6 +224,11 @@ public void LightenFunction(TestVector4 back, TestVector4 source, float amount,
|
192 | 224 | [MemberData(nameof(LightenFunctionData))]
|
193 | 225 | public void LightenFunction256(TestVector4 back, TestVector4 source, float amount, TestVector4 expected)
|
194 | 226 | {
|
| 227 | + if (!Avx.IsSupported) |
| 228 | + { |
| 229 | + return; |
| 230 | + } |
| 231 | + |
195 | 232 | Vector256<float> back256 = Vector256.Create(back.X, back.Y, back.Z, back.W, back.X, back.Y, back.Z, back.W);
|
196 | 233 | Vector256<float> source256 = Vector256.Create(source.X, source.Y, source.Z, source.W, source.X, source.Y, source.Z, source.W);
|
197 | 234 |
|
@@ -219,6 +256,11 @@ public void OverlayFunction(TestVector4 back, TestVector4 source, float amount,
|
219 | 256 | [MemberData(nameof(OverlayFunctionData))]
|
220 | 257 | public void OverlayFunction256(TestVector4 back, TestVector4 source, float amount, TestVector4 expected)
|
221 | 258 | {
|
| 259 | + if (!Avx.IsSupported) |
| 260 | + { |
| 261 | + return; |
| 262 | + } |
| 263 | + |
222 | 264 | Vector256<float> back256 = Vector256.Create(back.X, back.Y, back.Z, back.W, back.X, back.Y, back.Z, back.W);
|
223 | 265 | Vector256<float> source256 = Vector256.Create(source.X, source.Y, source.Z, source.W, source.X, source.Y, source.Z, source.W);
|
224 | 266 |
|
@@ -246,6 +288,11 @@ public void HardLightFunction(TestVector4 back, TestVector4 source, float amount
|
246 | 288 | [MemberData(nameof(HardLightFunctionData))]
|
247 | 289 | public void HardLightFunction256(TestVector4 back, TestVector4 source, float amount, TestVector4 expected)
|
248 | 290 | {
|
| 291 | + if (!Avx.IsSupported) |
| 292 | + { |
| 293 | + return; |
| 294 | + } |
| 295 | + |
249 | 296 | Vector256<float> back256 = Vector256.Create(back.X, back.Y, back.Z, back.W, back.X, back.Y, back.Z, back.W);
|
250 | 297 | Vector256<float> source256 = Vector256.Create(source.X, source.Y, source.Z, source.W, source.X, source.Y, source.Z, source.W);
|
251 | 298 |
|
|
0 commit comments