From 798404c91e73542540d386cf73503681bc2982c7 Mon Sep 17 00:00:00 2001 From: Jared Wasinger Date: Tue, 4 Aug 2020 17:18:01 +0000 Subject: [PATCH] remove redundant montmul in v2 code --- build/v2-f6m_mul_bench.bin | 2 +- build/v2-test.bin | 2 +- src/v2/benchmark.yul | 3 --- src/v2/test.yul | 3 --- 4 files changed, 2 insertions(+), 8 deletions(-) diff --git a/build/v2-f6m_mul_bench.bin b/build/v2-f6m_mul_bench.bin index 0917790..f0a74f8 100644 --- a/build/v2-f6m_mul_bench.bin +++ b/build/v2-f6m_mul_bench.bin @@ -1 +1 @@ -597fabaafffffffffeb9ffff53b1feffab1e24f6b0f6a0d23067bf1285f3844b776481527fd7ac4b43b6a71b4b9ae67f39ea11011a000000000000000000000000000000006020820152604081017f8f2990f3e598f5b1b8f480a3c388306bc023fac151c0104d13ec3aa18159940281527f72d1c8c528a1ce3bcaa280a8e735aa0d0000000000000000000000000000000060608301527f992d7a27906d4cd530b23a7e8c48c0778f8653fbc3332d63db24339d8bc65d7e60808301527fe83b6e91c6550f5aceab102e88e918090000000000000000000000000000000060a08301527f7299907146816f08c4c6a394e91374ed6ff3618a57358cfb124ee6ab4c560e5c60c08301527fac40700b41e2ee8674680728f0c5a6180000000000000000000000000000000060e08301527f0fd77f62b39eb952a0f8d21cec1f93b1d62dd7923aa86882ddf7dd4d3532b0b76101008301527fede8f3fc89fa4a79574067e2d9a9d200000000000000000000000000000000006101208301527f7a69de46b13d8cb4c4833224aaf9ef7ea6a48975ab35c6e123b8539ab84c381a6101408301527f2533401a73c4e79f47d714899d01ac130000000000000000000000000000000061016083015261018082017fa9fa0b0d8156c36a1a9ddacb73ef278f4d149b560e88789f2bfeb9f708b6cc2f81527f988927bfe0186d5bf9cb40cb07f21b18000000000000000000000000000000006101a08401526101c083017fecd347c808af644c7a3a971a556576f434e302b6b490004fb418a4a7da330a6781527f43adeca931169b8b92e91df73ae1e115000000000000000000000000000000006101e08501527f12a2829e11e843d764d5e3b80e75432d93f69b23ad79c38d43ebbc9bd2b17b9e6102008501527f903033351357b03602624762e5ad360d000000000000000000000000000000006102208501527fd7f9857dce663301f393f9fac66f5c49168494e0d20797a6c4f96327ed4fa47d6102408501527fd36d0078d217a712407d35046871d40f000000000000000000000000000000006102608501527f2f1b767f6c1ec190eb76a0bce7906ad2e4a7548d03e8aa745e34e1bf49d83ad66102808501527f4c04f57fb4d31039cb4cf01987fda213000000000000000000000000000000006102a08501527f7b3f8da2f2ae47885890b0d433a3eeed2f9f37cbcfc444e4f1d880390fcdb7656102c08501527f18d558857be01b2b10a8010bcdc6d606000000000000000000000000000000006102e085015261030084017f319c02f6132c8a786377868b5825ada9a5fe303e9ae3b03ce56e90734a17ce9781527f0c88b321012cf8dabb58211e3d50f6100000000000000000000000000000000061032086015261048085016106008601610780870161090088016789f3fffcfffcfffd61041a82828c878b8e6106c6565b61042882828c86888e6106c6565b600098505b60878910156104ce5761044482828c8b87896106c6565b61045282828c898c886106c6565b61046082828c888a8d6106c6565b61046e82828c87898b6106c6565b61047c82828c86888a6106c6565b61048a82828c8b87896106c6565b61049882828c898c886106c6565b6104a682828c888a8d6106c6565b6104b482828c87898b6106c6565b6104c282828c86888a6106c6565b5b60018901985061042d565b5050604081f35050505050505050610820565b86838287c086848388c05b5050505050505050565b86838287c186848388c15b5050505050505050565b604086016080870160c0880160008152600060e08a015260408501604085018989838387c28884848ac18989888888c28885898ac08989838387c288848686c088828887c060408801925088818785c050508787848384c286828283c15050505b505050505050565b6080890160408a018860808401848dc08860c084016040850183c088608085018584c08860c085016040860160c08e01c06105bb6101808c018b8b6101008f018f8761050b565b8886868dc088604087016040870183c0888b6101008d0184c188816101408d0160c08e01c18860408801888dc188604088018883c0888b838ac0888160c08d0160408b01c050505b505050505050505050565b6101008901876101008301608084018cc087610140830160c0840160408d01c08761010084016080850160808d01c087610140840160c0850160c08d01c06106616101808b018a8a8460808f018f61050b565b8786868cc087604087016040870160408d01c0878a8260808d01c18760408b016101408c0160c08d01c18760c08b0160808c0183c18760c08b0160808c016101408d01c087848289c05086604084016101408b0160408901c05b505050505050505050565b61018086016106d98187878a878761050b565b6106f081878760808b01608088016080880161050b565b61070a8187876101008b016101008801610100880161050b565b61072d6103008801866101c08a01846101408701610100880160408901896104e1565b6107546103008801866102408a016102008b016101408801610100890160408a018a6104e1565b61076e610300880187876102808b016102008c018661050b565b6107916103008801866101c08a01846101408c016101008d0160408e018e6104e1565b6107b96103008801866102408a016102008b016101c08c01866102c08e016102808f016104f6565b6107e36103008801866101408701610100880160c08c0160808d016102408e016102008f016104e1565b6107fe818787608088016101008c0160808d018d8a8a610574565b610816818787876101008c0160808d018d8a8a61060e565b505b505050505050565b +597fabaafffffffffeb9ffff53b1feffab1e24f6b0f6a0d23067bf1285f3844b776481527fd7ac4b43b6a71b4b9ae67f39ea11011a000000000000000000000000000000006020820152604081017f8f2990f3e598f5b1b8f480a3c388306bc023fac151c0104d13ec3aa18159940281527f72d1c8c528a1ce3bcaa280a8e735aa0d0000000000000000000000000000000060608301527f992d7a27906d4cd530b23a7e8c48c0778f8653fbc3332d63db24339d8bc65d7e60808301527fe83b6e91c6550f5aceab102e88e918090000000000000000000000000000000060a08301527f7299907146816f08c4c6a394e91374ed6ff3618a57358cfb124ee6ab4c560e5c60c08301527fac40700b41e2ee8674680728f0c5a6180000000000000000000000000000000060e08301527f0fd77f62b39eb952a0f8d21cec1f93b1d62dd7923aa86882ddf7dd4d3532b0b76101008301527fede8f3fc89fa4a79574067e2d9a9d200000000000000000000000000000000006101208301527f7a69de46b13d8cb4c4833224aaf9ef7ea6a48975ab35c6e123b8539ab84c381a6101408301527f2533401a73c4e79f47d714899d01ac130000000000000000000000000000000061016083015261018082017fa9fa0b0d8156c36a1a9ddacb73ef278f4d149b560e88789f2bfeb9f708b6cc2f81527f988927bfe0186d5bf9cb40cb07f21b18000000000000000000000000000000006101a08401526101c083017fecd347c808af644c7a3a971a556576f434e302b6b490004fb418a4a7da330a6781527f43adeca931169b8b92e91df73ae1e115000000000000000000000000000000006101e08501527f12a2829e11e843d764d5e3b80e75432d93f69b23ad79c38d43ebbc9bd2b17b9e6102008501527f903033351357b03602624762e5ad360d000000000000000000000000000000006102208501527fd7f9857dce663301f393f9fac66f5c49168494e0d20797a6c4f96327ed4fa47d6102408501527fd36d0078d217a712407d35046871d40f000000000000000000000000000000006102608501527f2f1b767f6c1ec190eb76a0bce7906ad2e4a7548d03e8aa745e34e1bf49d83ad66102808501527f4c04f57fb4d31039cb4cf01987fda213000000000000000000000000000000006102a08501527f7b3f8da2f2ae47885890b0d433a3eeed2f9f37cbcfc444e4f1d880390fcdb7656102c08501527f18d558857be01b2b10a8010bcdc6d606000000000000000000000000000000006102e085015261030084017f319c02f6132c8a786377868b5825ada9a5fe303e9ae3b03ce56e90734a17ce9781527f0c88b321012cf8dabb58211e3d50f6100000000000000000000000000000000061032086015261048085016106008601610780870161090088016789f3fffcfffcfffd61041a82828c878b8e6106c0565b61042882828c86888e6106c0565b600098505b60878910156104ce5761044482828c8b87896106c0565b61045282828c898c886106c0565b61046082828c888a8d6106c0565b61046e82828c87898b6106c0565b61047c82828c86888a6106c0565b61048a82828c8b87896106c0565b61049882828c898c886106c0565b6104a682828c888a8d6106c0565b6104b482828c87898b6106c0565b6104c282828c86888a6106c0565b5b60018901985061042d565b5050604081f3505050505050505061081a565b86838287c086848388c05b5050505050505050565b86838287c186848388c15b5050505050505050565b604086016080870160c0880160008152600060e08a015260408501604085018989838387c28884848ac18989888888c28885898ac088848686c088828887c060408801925088818785c050508787848384c286828283c15050505b505050505050565b6080890160408a018860808401848dc08860c084016040850183c088608085018584c08860c085016040860160c08e01c06105b56101808c018b8b6101008f018f8761050b565b8886868dc088604087016040870183c0888b6101008d0184c188816101408d0160c08e01c18860408801888dc188604088018883c0888b838ac0888160c08d0160408b01c050505b505050505050505050565b6101008901876101008301608084018cc087610140830160c0840160408d01c08761010084016080850160808d01c087610140840160c0850160c08d01c061065b6101808b018a8a8460808f018f61050b565b8786868cc087604087016040870160408d01c0878a8260808d01c18760408b016101408c0160c08d01c18760c08b0160808c0183c18760c08b0160808c016101408d01c087848289c05086604084016101408b0160408901c05b505050505050505050565b61018086016106d38187878a878761050b565b6106ea81878760808b01608088016080880161050b565b6107048187876101008b016101008801610100880161050b565b6107276103008801866101c08a01846101408701610100880160408901896104e1565b61074e6103008801866102408a016102008b016101408801610100890160408a018a6104e1565b610768610300880187876102808b016102008c018661050b565b61078b6103008801866101c08a01846101408c016101008d0160408e018e6104e1565b6107b36103008801866102408a016102008b016101c08c01866102c08e016102808f016104f6565b6107dd6103008801866101408701610100880160c08c0160808d016102408e016102008f016104e1565b6107f8818787608088016101008c0160808d018d8a8a61056e565b610810818787876101008c0160808d018d8a8a610608565b505b505050505050565b diff --git a/build/v2-test.bin b/build/v2-test.bin index a315600..b7ef022 100644 --- a/build/v2-test.bin +++ b/build/v2-test.bin @@ -1 +1 @@ -597f8f2990f3e598f5b1b8f480a3c388306bc023fac151c0104d13ec3aa18159940281527f72d1c8c528a1ce3bcaa280a8e735aa0d0000000000000000000000000000000060208201527f992d7a27906d4cd530b23a7e8c48c0778f8653fbc3332d63db24339d8bc65d7e60408201527fe83b6e91c6550f5aceab102e88e918090000000000000000000000000000000060608201527f7299907146816f08c4c6a394e91374ed6ff3618a57358cfb124ee6ab4c560e5c60808201527fac40700b41e2ee8674680728f0c5a6180000000000000000000000000000000060a08201527f0fd77f62b39eb952a0f8d21cec1f93b1d62dd7923aa86882ddf7dd4d3532b0b760c08201527fede8f3fc89fa4a79574067e2d9a9d2000000000000000000000000000000000060e08201527f7a69de46b13d8cb4c4833224aaf9ef7ea6a48975ab35c6e123b8539ab84c381a6101008201527f2533401a73c4e79f47d714899d01ac13000000000000000000000000000000006101208201527fa9fa0b0d8156c36a1a9ddacb73ef278f4d149b560e88789f2bfeb9f708b6cc2f6101408201527f988927bfe0186d5bf9cb40cb07f21b180000000000000000000000000000000061016082015261018081017fecd347c808af644c7a3a971a556576f434e302b6b490004fb418a4a7da330a6781527f43adeca931169b8b92e91df73ae1e115000000000000000000000000000000006101a08301527f12a2829e11e843d764d5e3b80e75432d93f69b23ad79c38d43ebbc9bd2b17b9e6101c08301527f903033351357b03602624762e5ad360d000000000000000000000000000000006101e08301527fd7f9857dce663301f393f9fac66f5c49168494e0d20797a6c4f96327ed4fa47d6102008301527fd36d0078d217a712407d35046871d40f000000000000000000000000000000006102208301527f2f1b767f6c1ec190eb76a0bce7906ad2e4a7548d03e8aa745e34e1bf49d83ad66102408301527f4c04f57fb4d31039cb4cf01987fda213000000000000000000000000000000006102608301527f7b3f8da2f2ae47885890b0d433a3eeed2f9f37cbcfc444e4f1d880390fcdb7656102808301527f18d558857be01b2b10a8010bcdc6d606000000000000000000000000000000006102a08301527f319c02f6132c8a786377868b5825ada9a5fe303e9ae3b03ce56e90734a17ce976102c08301527f0c88b321012cf8dabb58211e3d50f610000000000000000000000000000000006102e0830152610300820161048083017fabaafffffffffeb9ffff53b1feffab1e24f6b0f6a0d23067bf1285f3844b776481527fd7ac4b43b6a71b4b9ae67f39ea11011a000000000000000000000000000000006104a085015261040c61050085016789f3fffcfffcfffd83858789610869565b5060009150817ff4f3f4e0a35068eaac665aee2e71f682aecd20923b420023b6d5420ba01ea98282511414156104425760206000fd5b50807f87c314107a998a650ab3247ef39c920e000000000000000000000000000000006103208401511414156104785760006000fd5b807f2c9620d993a22bade623d165a9f4aa648af87cb7292b7821c0fcd0adcd14ba656103408401511414156104ad5760006000fd5b807f5da54df2ad93262e24fc62bcd97e7208000000000000000000000000000000006103608401511414156104e25760006000fd5b807fead1838e6c5e168543093c87eaeb576f940670026292dcb7a812600f4fb20a286103808401511414156105175760006000fd5b807f1be71ce1ef79f675e4a283b73906ca17000000000000000000000000000000006103a084015114141561054c5760006000fd5b807f9c8b2c76405445b20dd7635d562309f69c2c87601d9055a5e10df2ea1d28237f6103c08401511414156105815760006000fd5b807fafd0d32f7e8c19d4cd5a3d1ef65b120b000000000000000000000000000000006103e08401511414156105b65760006000fd5b807f40591ef0c74dbec983b7bef145a87957c1e09049dbc85fbb3e9bb1174892ee836104008401511414156105eb5760006000fd5b807f294ef8c4a5954fffbff4ca6aca74c718000000000000000000000000000000006104208401511414156106205760006000fd5b807f9b242b8f1c5d63bb525121bd68eda084ab7e6d015052d5adeb79ddb24091d2a86104408401511414156106555760006000fd5b807fe5b1da00212d0e6c11f01d23790113080000000000000000000000000000000061046084015114141561068a5760006000fd5b50506109c3565b86838287c086848388c05b5050505050505050565b86838287c186848388c15b5050505050505050565b604086016080870160408401604084018888838386c2878360c08c0189c18888878787c287848889c08888838386c287838585c087828786c060408701915087818684c0508787848384c286828283c15050505b505050505050565b6080890160408a018860808401848dc08860c084016040850183c088608085018584c08860c085016040860160c08e01c061075e6101808c018b8b6101008f018f876106bb565b8886868dc088604087016040870183c0888b6101008d0184c188816101408d0160c08e01c18860408801888dc188604088018883c0888b838ac0888160c08d0160408b01c050505b505050505050505050565b6101008901876101008301608084018cc087610140830160c0840160408d01c08761010084016080850160808d01c087610140840160c0850160c08d01c06108046101808b018a8a8460808f018f6106bb565b8786868cc087604087016040870160408d01c0878a8260808d01c18760408b016101408c0160c08d01c18760c08b0160808c0183c18760c08b0160808c016101408d01c087848289c05086604084016101408b0160408901c05b505050505050505050565b610180860161087c8187878a87876106bb565b61089381878760808b0160808801608088016106bb565b6108ad8187876101008b01610100880161010088016106bb565b6108d06103008801866101c08a0184610140870161010088016040890189610691565b6108f76103008801866102408a016102008b016101408801610100890160408a018a610691565b610911610300880187876102808b016102008c01866106bb565b6109346103008801866101c08a01846101408c016101008d0160408e018e610691565b61095c6103008801866102408a016102008b016101c08c01866102c08e016102808f016106a6565b6109866103008801866101408701610100880160c08c0160808d016102408e016102008f01610691565b6109a1818787608088016101008c0160808d018d8a8a610717565b6109b9818787876101008c0160808d018d8a8a6107b1565b505b505050505050565b +597f8f2990f3e598f5b1b8f480a3c388306bc023fac151c0104d13ec3aa18159940281527f72d1c8c528a1ce3bcaa280a8e735aa0d0000000000000000000000000000000060208201527f992d7a27906d4cd530b23a7e8c48c0778f8653fbc3332d63db24339d8bc65d7e60408201527fe83b6e91c6550f5aceab102e88e918090000000000000000000000000000000060608201527f7299907146816f08c4c6a394e91374ed6ff3618a57358cfb124ee6ab4c560e5c60808201527fac40700b41e2ee8674680728f0c5a6180000000000000000000000000000000060a08201527f0fd77f62b39eb952a0f8d21cec1f93b1d62dd7923aa86882ddf7dd4d3532b0b760c08201527fede8f3fc89fa4a79574067e2d9a9d2000000000000000000000000000000000060e08201527f7a69de46b13d8cb4c4833224aaf9ef7ea6a48975ab35c6e123b8539ab84c381a6101008201527f2533401a73c4e79f47d714899d01ac13000000000000000000000000000000006101208201527fa9fa0b0d8156c36a1a9ddacb73ef278f4d149b560e88789f2bfeb9f708b6cc2f6101408201527f988927bfe0186d5bf9cb40cb07f21b180000000000000000000000000000000061016082015261018081017fecd347c808af644c7a3a971a556576f434e302b6b490004fb418a4a7da330a6781527f43adeca931169b8b92e91df73ae1e115000000000000000000000000000000006101a08301527f12a2829e11e843d764d5e3b80e75432d93f69b23ad79c38d43ebbc9bd2b17b9e6101c08301527f903033351357b03602624762e5ad360d000000000000000000000000000000006101e08301527fd7f9857dce663301f393f9fac66f5c49168494e0d20797a6c4f96327ed4fa47d6102008301527fd36d0078d217a712407d35046871d40f000000000000000000000000000000006102208301527f2f1b767f6c1ec190eb76a0bce7906ad2e4a7548d03e8aa745e34e1bf49d83ad66102408301527f4c04f57fb4d31039cb4cf01987fda213000000000000000000000000000000006102608301527f7b3f8da2f2ae47885890b0d433a3eeed2f9f37cbcfc444e4f1d880390fcdb7656102808301527f18d558857be01b2b10a8010bcdc6d606000000000000000000000000000000006102a08301527f319c02f6132c8a786377868b5825ada9a5fe303e9ae3b03ce56e90734a17ce976102c08301527f0c88b321012cf8dabb58211e3d50f610000000000000000000000000000000006102e0830152610300820161048083017fabaafffffffffeb9ffff53b1feffab1e24f6b0f6a0d23067bf1285f3844b776481527fd7ac4b43b6a71b4b9ae67f39ea11011a000000000000000000000000000000006104a085015261040c61050085016789f3fffcfffcfffd83858789610863565b5060009150817ff4f3f4e0a35068eaac665aee2e71f682aecd20923b420023b6d5420ba01ea98282511414156104425760206000fd5b50807f87c314107a998a650ab3247ef39c920e000000000000000000000000000000006103208401511414156104785760006000fd5b807f2c9620d993a22bade623d165a9f4aa648af87cb7292b7821c0fcd0adcd14ba656103408401511414156104ad5760006000fd5b807f5da54df2ad93262e24fc62bcd97e7208000000000000000000000000000000006103608401511414156104e25760006000fd5b807fead1838e6c5e168543093c87eaeb576f940670026292dcb7a812600f4fb20a286103808401511414156105175760006000fd5b807f1be71ce1ef79f675e4a283b73906ca17000000000000000000000000000000006103a084015114141561054c5760006000fd5b807f9c8b2c76405445b20dd7635d562309f69c2c87601d9055a5e10df2ea1d28237f6103c08401511414156105815760006000fd5b807fafd0d32f7e8c19d4cd5a3d1ef65b120b000000000000000000000000000000006103e08401511414156105b65760006000fd5b807f40591ef0c74dbec983b7bef145a87957c1e09049dbc85fbb3e9bb1174892ee836104008401511414156105eb5760006000fd5b807f294ef8c4a5954fffbff4ca6aca74c718000000000000000000000000000000006104208401511414156106205760006000fd5b807f9b242b8f1c5d63bb525121bd68eda084ab7e6d015052d5adeb79ddb24091d2a86104408401511414156106555760006000fd5b807fe5b1da00212d0e6c11f01d23790113080000000000000000000000000000000061046084015114141561068a5760006000fd5b50506109bd565b86838287c086848388c05b5050505050505050565b86838287c186848388c15b5050505050505050565b604086016080870160408401604084018888838386c2878360c08c0189c18888878787c287848889c087838585c087828786c060408701915087818684c0508787848384c286828283c15050505b505050505050565b6080890160408a018860808401848dc08860c084016040850183c088608085018584c08860c085016040860160c08e01c06107586101808c018b8b6101008f018f876106bb565b8886868dc088604087016040870183c0888b6101008d0184c188816101408d0160c08e01c18860408801888dc188604088018883c0888b838ac0888160c08d0160408b01c050505b505050505050505050565b6101008901876101008301608084018cc087610140830160c0840160408d01c08761010084016080850160808d01c087610140840160c0850160c08d01c06107fe6101808b018a8a8460808f018f6106bb565b8786868cc087604087016040870160408d01c0878a8260808d01c18760408b016101408c0160c08d01c18760c08b0160808c0183c18760c08b0160808c016101408d01c087848289c05086604084016101408b0160408901c05b505050505050505050565b61018086016108768187878a87876106bb565b61088d81878760808b0160808801608088016106bb565b6108a78187876101008b01610100880161010088016106bb565b6108ca6103008801866101c08a0184610140870161010088016040890189610691565b6108f16103008801866102408a016102008b016101408801610100890160408a018a610691565b61090b610300880187876102808b016102008c01866106bb565b61092e6103008801866101c08a01846101408c016101008d0160408e018e610691565b6109566103008801866102408a016102008b016101c08c01866102c08e016102808f016106a6565b6109806103008801866101408701610100880160c08c0160808d016102408e016102008f01610691565b61099b818787608088016101008c0160808d018d8a8a610711565b6109b3818787876101008c0160808d018d8a8a6107ab565b505b505050505050565b diff --git a/src/v2/benchmark.yul b/src/v2/benchmark.yul index 865e95a..f56dbd7 100644 --- a/src/v2/benchmark.yul +++ b/src/v2/benchmark.yul @@ -56,9 +56,6 @@ // r1 = ((y0 + y1) * (x0 + x1)) - ((x0 * y0) + (x1 * y1)) - // tmp2 <- x1 * y1 - mulmodmont384(tmp2, add(x, 64), add(y, 64), modulus, inv) - // tmp2 <- tmp (x0 * y0) + tmp2 (x1 * y1) addmod384(tmp2, tmp, tmp2, modulus) diff --git a/src/v2/test.yul b/src/v2/test.yul index 7a626de..2ad41c5 100644 --- a/src/v2/test.yul +++ b/src/v2/test.yul @@ -50,9 +50,6 @@ // r1 = ((y0 + y1) * (x0 + x1)) - ((x0 * y0) + (x1 * y1)) - // tmp2 <- x1 * y1 - mulmodmont384(tmp2, add(x, 64), add(y, 64), modulus, inv) - // tmp2 <- tmp (x0 * y0) + tmp2 (x1 * y1) addmod384(tmp2, tmp, tmp2, modulus)