t...@gmplib.org (Torbjörn Granlund) writes: > Perhaps keeping the to-be-swapped variables in two structs, and instead > conditionally swap pointers to the structs?
Hmm. Definitely worth a try. But if we need explicit loads and stores from the structs, we'll not save that many instructions. Each iteration needs to load all the values but store only half of them, so for each pair of values load + load + store, compared to mov, xor, and, xor, xor for conditionally swapping using a mask. > Some measurements with method 4 and 5 are now in. Modern Intel CPUs > like method 5, as I had expected. Nice! With a few % margin over method 3. Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. Internet email is subject to wholesale government surveillance. _______________________________________________ gmp-devel mailing list gmp-devel@gmplib.org https://gmplib.org/mailman/listinfo/gmp-devel