static void extraInteger(this ExtraWriter w, string i, bool avx) { w.writeExtra(eExtra.int_common, i, "all"); w.writeExtra(eExtra.bitwise, i, "all"); w.line(); w.line(" // ==== Couple missing integer comparison intrinsics ===="); w.writeExtra(eExtra.int_math, i, "epi8"); w.writeExtra(eExtra.int_math, i, "epi16"); w.writeExtra(eExtra.int_math, i, "epi32"); if (avx) { w.writeExtra(eExtra.int_math, i, "epi64"); } w.line(); w.line("#if INTRINSICS_SUPPORT_OPERATORS"); w.writeExtra(eExtra.int_math_ops, i, "epi8", "Int8"); w.writeExtra(eExtra.int_math_ops, i, "epi16", "Int16"); w.writeExtra(eExtra.int_math_ops, i, "epi32", "Int32"); if (avx) { w.writeExtra(eExtra.int_math_ops, i, "epi64", "Int64"); } w.line("#endif // INTRINSICS_SUPPORT_OPERATORS"); }
static void extraFloat(this ExtraWriter w, string f, string suffix, bool avx) { if (avx) { w.writeExtra(eExtra.float_avx_cmp, f, suffix); } w.writeExtra(eExtra.float_math, f, suffix); w.writeExtra(eExtra.float_cmp_ops, f, suffix); w.writeExtra(eExtra.bitwise, f, suffix); }
public override void Write(char value) { this.BaseWriter.Write(value); foreach (TextWriter ExtraWriter in this.ExtraWriters) { ExtraWriter.Write(value); } base.Write(value); }
public override void Flush() { this.BaseWriter.Flush(); foreach (TextWriter ExtraWriter in this.ExtraWriters) { ExtraWriter.Flush(); } base.Flush(); }
public override void Close() { this.BaseWriter.Close(); foreach (TextWriter ExtraWriter in this.ExtraWriters) { ExtraWriter.Close(); } base.Close(); }
protected override void Dispose(bool disposing) { if (disposing) { this.BaseWriter.Dispose(); foreach (TextWriter ExtraWriter in this.ExtraWriters) { ExtraWriter.Dispose(); } } base.Dispose(disposing); }
public static void generateExtras(string destFolder) { ExtraCodeParser.copyStatic("fp16c.hpp", destFolder); string extra = Path.Combine(destFolder, "Extra"); if (!Directory.Exists(extra)) { Directory.CreateDirectory(extra); } ExtraCodeParser.copyStatic("common.hpp", extra); string f = "__m128"; string d = "__m128d"; string i = "__m128i"; // SSE1 using (var w = new ExtraWriter(extra, "sse-extra", "Sse")) { w.writeExtra(eExtra.sse1, f, "ps"); w.extraFloat(f, "ps", false); } // SSE2 using (var w = new ExtraWriter(extra, "sse2-extra", "Sse", @"""../sse.hpp""")) { // Double stuff w.writeExtra(eExtra.sse2, d, "pd"); w.extraFloat(d, "pd", false); w.line(); w.extraInteger(i, false); } // SSE 4.2 using (var w = new ExtraWriter(extra, "sse4.2-extra", "Sse", @"""../sse2.hpp""", @"""../sse4.1.hpp""")) // cmpeq_epi64 is SSE 4.1, while cmpgt_epi64 is SSE 4.2. Looks like Intel forgot about that, and fixed later :-) { w.writeExtra(eExtra.sse42, null, null); w.writeExtra(eExtra.int_math, i, "epi64"); w.line(); w.line("#if INTRINSICS_SUPPORT_OPERATORS"); w.writeExtra(eExtra.int_math_ops, i, "epi64", "Int64"); w.line("#endif // INTRINSICS_SUPPORT_OPERATORS"); } // AVX1 f = "__m256"; d = "__m256d"; i = "__m256i"; using (var w = new ExtraWriter(extra, "avx-extra", "Avx")) { w.writeExtra(eExtra.avx1, f, "ps"); w.extraFloat(f, "ps", true); w.extraFloat(d, "pd", true); } // AVX2 using (var w = new ExtraWriter(extra, "avx2-extra", "Avx", @"""../avx.hpp""")) { w.writeExtra(eExtra.avx2, f, "ps"); w.extraInteger(i, true); } }