Apple M1 Microarchitecture Research by Dougall Johnson

Firestorm: Overview | Base Instructions | SIMD and FP Instructions
Icestorm:  Overview | Base Instructions | SIMD and FP Instructions

CLZ (vector, 4H)

Test 1: uops

Code:

  clz v0.4h, v0.4h
  movi v0.16b, 1
  movi v1.16b, 2

(no loop instructions)

1000 unrolls and 1 iteration

Retires: 1.000

Issues: 1.000

Integer unit issues: 0.000

Load/store unit issues: 0.000

SIMD/FP unit issues: 1.000

retire (01)cycle (02)03071e3f4e51inst issue (52)~issue fp/simd (54)~dispatch fp/simd (57)huge thing fp/simd (5b)60696d6edispatch stall (70)scheduler rewind (75)scheduler stall (76)~dispatch op (78)~map op fp/simd (7e)~map lookup fp/simd (81)8283pipeline redirect (84)85inst all (8c)inst neon or fp (9a)a8accfd5d6ddinst fetch restart (de)e0? fp/simd (ee)f5f6f7f8fd
1004203715006116862510001000100026452112018203720371571318951000100010002037203711100110000073316331784100020382038203820382038
1004203715006116862510001000100026452112018203720371571318951000100010002037203711100110000073216331784100020382038203820382038
1004203715008216862510001000100026452112018203720371571318951000100010002037203711100110000073216221786100020382038203820382038
1004203715006116862510001000100026452112018203720371571318951000100010002037203711100110000075216331786100020382038203820382038
1004203715006116862510001000100026452112018203720371571318951000100010002037203711100110000075316231784100020382038203820382038
10042037150013816862510001000100026452112018203720371570318951000100010002037203711100110000073216221786100020382038203820382038
1004203715006116862510001000100026452112018203720371571318951000100010002037203711100110000075216221786100020382038203820382038
1004203715106116862510001000100026452112018203720371571318951000100010002037203711100110000075216221786100020382038203820382038
1004203715006116862510001000100026452112018203720371570318951000100010002037203711100110000073216221786100020382038203820382038
100420371503015616862510001000100026452112018203720371571318951000100010002037203711100110000075316221786100020382038203820382038

Test 2: Latency 1->2

Code:

  clz v0.4h, v0.4h
  movi v0.16b, 1
  movi v1.16b, 2

(fused SUBS/B.cc loop)

100 unrolls and 100 iterations

Result (median cycles for code): 2.0037

retire (01)cycle (02)03090b1e3f4e51inst issue (52)~issue int (53)~issue fp/simd (54)~dispatch int (56)~dispatch fp/simd (57)huge thing int (59)huge thing fp/simd (5b)6061696b6d6edispatch stall (70)72scheduler rewind (75)scheduler stall (76)~dispatch op (78)~map op int (7c)~map op fp/simd (7e)~map lookup int (7f)~map lookup fp/simd (81)8283pipeline redirect (84)85inst all (8c)inst branch (8d)inst branch taken (90)inst b.cc (94)inst integer (97)inst neon or fp (9a)9fa8accfd0d5d6ddinst fetch restart (de)e0? fp/simd (ee)gpr retires (ef)f5f6f7f8fd
102042003715100061196862510100100100001001000050028475211020018020037200371842103187451010020010000200100002003720037111020110099100100100001000071001161119791100001002003820038200382003820038
102042003715000061196862510100100100001001000050028475211020018020037200371842103187451010020010000200100002003720037111020110099100100100001000071001161119791100001002003820038200382003820038
102042003715000061196862510100100100001001000050028475211020018020037200371842103187451010020010000200100002003720037111020110099100100100001000071001161119791100001002003820038200382003820038
102042003715000061196862510100100100001001000050028475210020018020037200371842103187451010020010000200100002003720037111020110099100100100001000071001161119791100001002003820038200382003820038
10204200371500019861196862510100100100001001000050028475211020018020037200371842103187451010020010000200100002003720037111020110099100100100001000071001161119791100001002003820038200382003820038
102042003715000061196862510100100100001001000050028475211020018020037200371842103187451010020010000200100002003720037111020110099100100100001000071001161119791100001002003820038200382003820038
102042003715000061196862510100100100001001000050028475211020018020037200371842103187451010020010000200100002003720037111020110099100100100001000071001161119791100001002003820038200382003820038
102042003715000061196862510100100100001001000050028475210020018020037200371842103187451010020010000200100002003720037111020110099100100100001000071001161119791100001002003820038200382003820038
102042003715000061196862510100100100001001000050028475211020018020037200371842103187451010020010000200100002003720037111020110099100100100001000071001161119791100001002003820038200382003820038
10204200371500001241968625101001001000010010000500284752110200180200372003718421031874510100200100002001000020037200371110201100991001001000010043071001161119791100001002003820038200382003820038

1000 unrolls and 10 iterations

Result (median cycles for code): 2.0037

retire (01)cycle (02)03080b18191e1f3f4e51inst issue (52)~issue int (53)~issue fp/simd (54)~dispatch int (56)~dispatch fp/simd (57)huge thing int (59)huge thing fp/simd (5b)696d6edispatch stall (70)scheduler rewind (75)scheduler stall (76)~dispatch op (78)~map op int (7c)~map op fp/simd (7e)~map lookup int (7f)~map lookup fp/simd (81)8283pipeline redirect (84)85inst all (8c)inst branch (8d)inst branch taken (90)inst b.cc (94)inst integer (97)inst neon or fp (9a)9fa0a1a6a7a8a9acc2cfd5d6ddinst fetch restart (de)e0? int output thing (e9)? fp/simd (ee)gpr retires (ef)f5f6f7f8fd
100242003715000000061196862510010101000010100005028475212001820037200371844331876710010201000020100002003720037111002110910101000010000000006404163419786010000102003820038200382003820038
100242003715000000061196862510010101000010100005028475212001820037200371844331876710010201000020100002003720037111002110910101000010000000006404163419786010000102003820038200382003820038
100242003715000000061196862510010101000010100005028475212001820037200371844331876710010201000020100002003720037111002110910101000010000000006404163419786010000102003820038200382003820038
1002420037150000000708196862510010101000010100005028475212001820037200371844331876710010201000020100002003720037111002110910101000010000000006404164319786010000102003820038200382003820038
100242003715000000061196862510010101000010100005028475212001820037200371844331876710010201000020100002003720037111002110910101000010000000006404163419786010000102003820038200382003820038
1002420037150000000124196862510010101000010100005028475212001820037200371844331876710010201000020100002003720037111002110910101000010000000006404164319786010000102003820038200382003820038
100242003715000000061196862510010101000010100005028475212001820037200371844331876710010201000020100002003720037111002110910101000010000000006404163419786010000102003820038200382003820038
100242003715000000061196862510010101000010100005028475212001820037200371844331876710010201000020100002003720037111002110910101000010000000006403164419786010000102003820038200382003820038
1002420037150000000699196862510010101000010100005028475212001820037200371844331876710010201000020100002003720037111002110910101000010000000006403164319786010000102003820038200382003820038
1002420037150000000706196862510010101000010100005028475212001820037200371844331876710010201000020100002022620037111002110910101000010000000006404163219786010000102003820038200382003820038

Test 3: throughput

Count: 8

Code:

  clz v0.4h, v8.4h
  clz v1.4h, v8.4h
  clz v2.4h, v8.4h
  clz v3.4h, v8.4h
  clz v4.4h, v8.4h
  clz v5.4h, v8.4h
  clz v6.4h, v8.4h
  clz v7.4h, v8.4h
  movi v8.16b, 9

(fused SUBS/B.cc loop)

100 unrolls and 100 iterations

Result (median cycles for code divided by count): 0.2505

retire (01)cycle (02)033f51inst issue (52)~issue int (53)~issue fp/simd (54)~dispatch int (56)~dispatch fp/simd (57)huge thing int (59)huge thing fp/simd (5b)60696d6edispatch stall (70)scheduler rewind (75)scheduler stall (76)~dispatch op (78)~map op int (7c)~map op fp/simd (7e)~map lookup int (7f)~map lookup fp/simd (81)8283pipeline redirect (84)85inst all (8c)inst branch (8d)inst branch taken (90)inst b.cc (94)inst integer (97)inst neon or fp (9a)9fa8acc5branch mispredict (cb)cdcfd5d6ddinst fetch restart (de)e0? fp/simd (ee)gpr retires (ef)f5f6f7f8fd
8020420109150292580108100800081008002050064013212001920038200389977699898012020080032200800322003820144118020110099100100800001000011151184163320035800001002003920039200392003920039
80204200381507382580108100800081008002050064013212001920038200389977699898012020080032200800322003820038118020110099100100800001001011151183163320035800001002003920039200392003920039
80204200381507772580108100800081008002050064013212001920038200389977699898012020080032200800322003820038118020110099100100800001000011151183162320035800001002003920039200392003920039
8020420038150292580108100800081008002050064013212001920038200389977699898012020080032200800322003820038118020110099100100800001000011151183164320035800001002003920039200392003920039
80204200381508292580108100800081008002050064013212001920038200389977699898012020080032200800322003820038118020110099100100800001000011151182163320035800001002003920039200392003920039
8020420038150292580108100800081008002050064013212001920038200389977699898012020080032200800322003820038118020110099100100800001000011151184164420035800001002003920039200392003920039
8020420038150292580108100800081008002050064013212001920038200389977699898012020080032200800322003820038118020110099100100800001000011151183164420035800001002003920039200392003920039
8020420038150292580108100800081008002050064013212001920038200389977699898012020080032200800322003820038118020110099100100800001000011151183163320035800001002003920039200392003920039
80204200381503142580108100800081008002050064013212001920038200389977699898012020080032200800322003820038118020110099100100800001000011151183163320035800001002003920039200392003920039
80204200381508642580108100800081008002050064013212001920038200389977699898012020080032200800322003820038118020110099100100800001000011151182163220035800001002003920039200392003920039

1000 unrolls and 10 iterations

Result (median cycles for code divided by count): 0.2505

retire (01)cycle (02)03181e3a3f51inst issue (52)~issue int (53)~issue fp/simd (54)~dispatch int (56)~dispatch fp/simd (57)huge thing int (59)huge thing fp/simd (5b)60696d6edispatch stall (70)scheduler rewind (75)scheduler stall (76)~dispatch op (78)~map op int (7c)~map op fp/simd (7e)~map lookup int (7f)~map lookup fp/simd (81)8283pipeline redirect (84)85inst all (8c)inst branch (8d)inst branch taken (90)inst b.cc (94)inst integer (97)inst neon or fp (9a)9fa0a1a8a9accfd5d6ddinst fetch restart (de)e0? fp/simd (ee)gpr retires (ef)f5f6f7f8fd
80024200501500008125800101080000108000050640000020019200382003899963100188001020800002080000200382003811800211091010800001000000502017161362003580000102003920039200392003920039
8002420038150000392580010108000010800005064000002001920038200389996310018800102080000208000020038200381180021109101080000100000050206166152003580000102003920039200392003920092
800242003815013039258001010800941080000506400000200192003820038999631001880010208000020800002003820038118002110910108000010420435037161616162003580000102003920039200392003920039
80024200381500003925800101080000108000050640000020019200382003899963100188001020800002080000200382003811800211091010800001000003502061616162003580000102003920039200392003920039
8002420038150000392580010108000010800005064000002001920038200389996310018800102080000208000020038200381180021109101080000100000350206161662003580000102003920039200392003920039
800242003815000081258001010800001080000506400001200192003820038999631001880010208000020800002003820038118002110910108000010000005020161615152003580000102003920039200392003920039
80024200381500008125800101080000108000050640000120019200382003899963100188001020800962080000200382003811800211091010800001000001850206166132003580000102008920039200392003920039
8002420038150036039258001010800001080000506400000200192003820038999631001880010208000020800002003820038118002110910108000010000005020171616162003580000102003920039200392003920039
800242003815000039258001010800001080000506400001200192003820038999631001880010208000020800002003820038118002110910108000010000005020161616162003580000102003920039200392003920039
8002420038150030392580010108000010800005064000002001920038200389996310018800102080000208000020038200381180021109101080000100000050206166162003580000102003920039200392003920039