Repository: dotnet/runtime
File: src/libraries/System.Private.CoreLib/src/System/Numerics/Matrix4x4.Impl.cs (C#)

Code before:
                // | i j k l |     | n o p |     | m o p |     | m n p |     | m n o |
                // | m n o p |
                //
                //   | f g h |
                // a | j k l | = a ( f ( kp - lo ) - g ( jp - ln ) + h ( jo - kn ) )
                //   | n o p |
                //
                //   | e g h |
                // b | i k l | = b ( e ( kp - lo ) - g ( ip - lm ) + h ( io - km ) )
                //   | m o p |
                //
                //   | e f h |
                // c | i j l | = c ( e ( jp - ln ) - f ( ip - lm ) + h ( in - jm ) )
                //   | m n p |
                //
                //   | e f g |
                // d | i j k | = d ( e ( jo - kn ) - f ( io - km ) + g ( in - jm ) )
                //   | m n o |
                //
                // Cost of operation
                // 17 adds and 28 muls.
                //
                // add: 6 + 8 + 3 = 17
                // mul: 12 + 16 = 28

                if (Sse.IsSupported)
                {
                    Vector128<float> w = W.AsVector128();
                    Vector128<float> x = X.AsVector128();
                    Vector128<float> y = Y.AsVector128();
                    Vector128<float> z = Z.AsVector128();

                    Vector128<float> z_kjji = Sse.Shuffle(z, z, 0b00010110);
                    Vector128<float> z_iiij = Sse.Shuffle(z, z, 0b01000000);
                    Vector128<float> w_ppop = Sse.Shuffle(w, w, 0b11101111);
                    Vector128<float> w_onpo = Sse.Shuffle(w, w, 0b10110110);
                    Vector128<float> z_llkl = Sse.Shuffle(z, z, 0b11101111);
                    Vector128<float> z_kjlk = Sse.Shuffle(z, z, 0b10110110);
                    Vector128<float> w_onnm = Sse.Shuffle(w, w, 0b00010110);
                    Vector128<float> w_mmmn = Sse.Shuffle(w, w, 0b01000000);
                    Vector128<float> y_feee = Sse.Shuffle(y, y, 0b00000001);
                    Vector128<float> y_ggff = Sse.Shuffle(y, y, 0b01011010);
                    Vector128<float> y_hhhg = Sse.Shuffle(y, y, 0b10111111);

                    // tmp1[0] = kp_lo
                    // tmp1[1] = jp_ln
                    // tmp1[2] = jo_kn
                    // tmp1[3] = ip_lm
                    Vector128<float> tmp1 = z_kjji * w_ppop - z_llkl * w_onnm;

                    // tmp2[0] = io_km

Review comment (suggestion):
If we switch to this being fully xplat, then this can be:

```suggestion
                if (Vector128.IsHardwareAccelerated)
```

Code after:
                // | i j k l |     | n o p |     | m o p |     | m n p |     | m n o |
                // | m n o p |
                //
                //   | f g h |
                // a | j k l | = a ( f ( kp - lo ) - g ( jp - ln ) + h ( jo - kn ) )
                //   | n o p |
                //
                //   | e g h |
                // b | i k l | = b ( e ( kp - lo ) - g ( ip - lm ) + h ( io - km ) )
                //   | m o p |
                //
                //   | e f h |
                // c | i j l | = c ( e ( jp - ln ) - f ( ip - lm ) + h ( in - jm ) )
                //   | m n p |
                //
                //   | e f g |
                // d | i j k | = d ( e ( jo - kn ) - f ( io - km ) + g ( in - jm ) )
                //   | m n o |
                //
                // Cost of operation
                // 17 adds and 28 muls.
                //
                // add: 6 + 8 + 3 = 17
                // mul: 12 + 16 = 28

                if (Vector128.IsHardwareAccelerated)
                {
                    Vector128<float> w = W.AsVector128();
                    Vector128<float> x = X.AsVector128();
                    Vector128<float> y = Y.AsVector128();
                    Vector128<float> z = Z.AsVector128();

                    Vector128<float> z_kjji = Vector128.Shuffle(z, Vector128.Create(2, 1, 1, 0));
                    Vector128<float> z_iiij = Vector128.Shuffle(z, Vector128.Create(0, 0, 0, 1));
                    Vector128<float> w_ppop = Vector128.Shuffle(w, Vector128.Create(3, 3, 2, 3));
                    Vector128<float> w_onpo = Vector128.Shuffle(w, Vector128.Create(2, 1, 3, 2));
                    Vector128<float> z_llkl = Vector128.Shuffle(z, Vector128.Create(3, 3, 2, 3));
                    Vector128<float> z_kjlk = Vector128.Shuffle(z, Vector128.Create(2, 1, 3, 2));
                    Vector128<float> w_onnm = Vector128.Shuffle(w, Vector128.Create(2, 1, 1, 0));
                    Vector128<float> w_mmmn = Vector128.Shuffle(w, Vector128.Create(0, 0, 0, 1));
                    Vector128<float> y_feee = Vector128.Shuffle(y, Vector128.Create(1, 0, 0, 0));
                    Vector128<float> y_ggff = Vector128.Shuffle(y, Vector128.Create(2, 2, 1, 1));
                    Vector128<float> y_hhhg = Vector128.Shuffle(y, Vector128.Create(3, 3, 3, 2));

                    // tmp1[0] = kp_lo
                    // tmp1[1] = jp_ln
                    // tmp1[2] = jo_kn
                    // tmp1[3] = ip_lm
                    Vector128<float> tmp1 = z_kjji * w_ppop - z_llkl * w_onnm;

                    // tmp2[0] = io_km