Apple M1 Microarchitecture Research by Dougall Johnson

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

FCSEL (scalar, S)

Test 1: Latency 1->2

Code:

  fcsel s0, s0, s1, lt
  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)03041e3f4e51inst 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)9fa1a8accfd5d6ddinst fetch restart (de)e0? int output thing (e9)? fp/simd (ee)gpr retires (ef)f5f6f7f8fd
102042003715010441198222510100100100001001000050014238801200182003720037185663187451010020010000200300002003720037111020110099100100100001010001071011611199070100001002003820038200382003820038
10204200371500061198222510100100100001001000050014238800200182003720037185663187451010020010000200300002003720037111020110099100100100001010000971011611199070100001002003820038200382003820038
10204200371500061198222510100100100001001000050014238800200182003720037185663187451010020010000200300002003720037111020110099100100100001010000071011611199070100001002003820038200382003820038
102042003715000232198222510100100100001001000050014238800200182003720037185663187451010020010000200300002003720037111020110099100100100001010000071011611199070100001002003820038200382003820038
10204200371500216119822251010010010000100100005001423880020018200372003718566318745101002001000020030000200372003711102011009910010010000101004441571011611199070100001002003820038200382003820038
102042003715000536198222510100100100001001000050014238801200182003720037185663187451010020010000200300002003720037111020110099100100100001010000071011611199070100001002003820038200382003820038
1020420037150006119822251010010010000100100005001423880120018200372003718566318745101002001000020030000200372003711102011009910010010000101000014771011611199070100001002003820038200382003820038
10204200371500061198222510100100100001001000050014238800200182003720037185663187451010020010000200300002003720037111020110099100100100001010002371011611199070100001002003820038200382003820038
102042003714900611982225101001001000010010000500142388012001820037200371856631874510100200100002003000020037200371110201100991001001000010100069371011611199070100001002003820038200382003820038
10204200371490061198222510100100100001001000050014238800200182003720037185663187601010020010000200300002003720037111020110099100100100001010005071011611199070100001002003820038200382003820038

1000 unrolls and 10 iterations

Result (median cycles for code): 2.0037

retire (01)cycle (02)03080b18191e1f3a3f4e51inst 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)9fa0a6a7a8a9acc2cfd5d6ddinst fetch restart (de)e0? int output thing (e9)? fp/simd (ee)gpr retires (ef)f5f6f7f8fd
1002420037150000000061198222510010101000010100005014238801200182003720037185883187671001020100002030000200372003711100211091010100001001000000006402162219907110000102003820038200382003820038
1002420037150000000061198222510010101000010100005014238800200182003720037185883187671001020100002030000200372003711100211091010100001001000000006402162219907010000102003820038200382003820038
1002420037150000000061198222510010101000010100005014238800200182003720037185883187671001020100002030000200372003711100211091010100001001000010306402162219907010000102003820038200382003820038
1002420037150000000061198222510010101000010100005014238801200182003720037185883187671001020100002030000200372003711100211091010100001001000000006402162219907010000102003820038200382003820038
1002420037150000000089198222510010101000010100005014238801200182003720037185883187671001020100002030000200372003711100211091010100001001000000006402162219907010000102003820038200382003820038
1002420037150000000061198222510010101000010100005014238801200182003720037185883187671001020100002030000200372003711100211091010100001001000010006402162219907010000102003820038200382003820038
1002420037150000000061198222510010101000010100005014238801200182003720037185883187671001020100002030000200372003711100211091010100001001000000006402162219907010000102003820038200382003820038
1002420037150000000061198222510010101000010100005014238801200182003720037185883187671001020100002030000200372003711100211091010100001001000000006402162219907010000102003820038200382003820038
1002420037150000000061198222510010101000010100005014238801200182003720037185883187671001020100002030000200372003711100211091010100001001000000006402162219907010000102003820038200382003820038
1002420037150000000061198222510010101000010100005014238801200182003720037185883187671001020100002030000200372003711100211091010100001001000000006402162219907010000102003820038200382003820038

Test 2: uops

Code:

  fcsel s0, s1, s0, lt
  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)031e3f4e51inst 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)9fa8accfd5d6ddinst fetch restart (de)e0? fp/simd (ee)f5f6f7f8fd
1004203716061182225100010001000136880120182037203717163189510001000300020372037111001100010000073116111907100020382038203820382038
1004203715061182225100010001000136880120182037203717163189510001000300020372037111001100010000073116111907100020382038203820382038
1004203715061182225100010001000136880120182037203717163189510001000300020372037111001100010000073116111907100020382038203820382038
1004203715061182225100010001000136880120182037203717163189510001000300020372037111001100010007073116111907100020382038203820382038
1004203715061182225100010001000136880120182037203717163189510001000300020372037111001100010000073116111907100020382038203820382038
10042037161261182225100010001000136880120182037203717163189510001000300020372037111001100010000073116111907100020382038203820382038
1004203715061182225100010001000136880120182037203717163189510001000300020372037111001100010000073116111907100020382038203820382038
1004203715061182225100010001000136880120182037203717163189510001000300020372037111001100010000073116111907100020382038203820382038
1004203715061182225100010001000136880120182037203717163189510001000300020372037111001100010000073116111907100020382038203820382038
1004203716061182225100010001000136880020182037203717163189510001000300020372037111001100010000973116111907100020382038203820382038

Test 3: Latency 1->3

Code:

  fcsel s0, s1, s0, lt
  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)03081e3f4e51inst 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)9fa8accfd5d6ddinst fetch restart (de)e0? fp/simd (ee)gpr retires (ef)f5f6f7f8fd
1020420037150007261982225101001001000010010000500142388012001820037200371856631874510198200100002003000020037200371110201100991001001000010100207101161119907100001002003820038200382003820038
10204200371500061198222510100100100001001000050014238800200182003720037185663187451010020010000200300002003720037111020110099100100100001010001777101161119907100001002003820038200382003820038
10204200371490061198222510100100100001001000050014238800200182003720037185663187451010020010000200300002003720037111020110099100100100001010001117101161119907100001002003820038200382003820038
102042003715000611982225101001001000010010000500142388002001820037200371856631874510100200100002003000020037200371110201100991001001000010100207101161119907100001002003820038200382003820038
102042003715000611982225101001001000010010000500142388012001820037200371856631874510100200100002003000020037200371110201100991001001000010100007101161119907100001002003820038200382003820038
10204200371500053619822251010010010000100100005001423880120018200372003718566318745101002001000020030000200372003711102011009910010010000101004207101161119907100001002003820038200382003820038
102042003715000611982225101001001000010010000500142388012001820037200371856631874510100200100002003000020037200371110201100991001001000010100007101161119907100001002003820038200382003820038
102042003714900611982225101001001000010010000500142388012001820037200371856631874510100200100002003000020037200371110201100991001001000010100007101161119907100001002003820038200382003820038
102042003715000611982225101001001000010010000500142388012001820037200371856631874510100200100002003000020037200371110201100991001001000010100007101160119907100001002003820038200382003820038
102042003715000611982225101001001000010010000500142388012001820037200371856631874510100200100002003000020037200371110201100991001001000010100007101161119907100001002003820038200382003820038

1000 unrolls and 10 iterations

Result (median cycles for code): 2.0037

retire (01)cycle (02)0308090b1e3f4e51inst 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)60696b6d6edispatch 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)9fa0a8a9accdcfd5d6ddinst fetch restart (de)e0? fp/simd (ee)gpr retires (ef)f5f6f7f8fd
100242003715000001031982225100101010000101000050142388012001802003720037185883187671001020100002030000200372003711100211091010100001001001030640216221990710000102003820038200382003820038
100242003715000001661982225100101010000101000050142388012001802003720037185883187671001020100002030000200372003711100211091010100001001000000640216221990710000102003820038200382003820038
10024200371500000611982225100101010000101000050142388012001802003720037185883187671001020100002030000200372003711100211091010100001001000000640216221990710000102003820038200382003820038
100242003715000005401982225100101010000101000050142388012001802003720037185883187671001020100002030000200372003711100211091010100001001000000640216221990710000102003820038200382003820038
10024200371500000611982225100101010000101000050142388012001802003720037185883187671001020100002030000200372003711100211091010100001001001000640216221990710000102003820038200382003820038
10024200371500000611982225100101010000101000050142388012001802003720037185883187671001020100002030000200372003711100211091010100001001000000640216221990710000102003820038200382003820038
10024200371500000611982225100101010000101000050142388012001802003720037185883187671001020100002030000200372003711100211091010100001001000000640216221990710000102003820038200382003820038
10024200371500000611982225100101010000101000050142388012001802003720037185883187671001020100002030000200372003711100211091010100001001000001640216221990710000102003820227200382003820038
10024200371500000611982225100101010000101000050142388012001802003720037185883187671001020100002030000200372003711100211091010100001001000000640216221990710000102003820038200382003820038
10024200371500000611982225100101010000101000050142388012001802003720037185883187671001020100002030000200372003711100211091010100001001000000640216221990710000102003820038200382003820038

Test 4: Latency 1->4

Chain cycles: 2

Code:

  fcsel s0, s1, s2, lt
  fcmp d0, d3
  movi v0.16b, 1
  movi v1.16b, 2
  movi v2.16b, 3
  movi v3.16b, 4

(non-fused SUB/CBNZ loop)

100 unrolls and 100 iterations

Result (median cycles for code, minus 2 chain cycles): 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 integer (97)inst neon or fp (9a)9fa1a6a8accfd5d6ddinst fetch restart (de)e0? int output thing (e9)? fp/simd (ee)gpr retires (ef)f5f6f7f8fd
20204400373000000005363982225202002002000020020000110028543714001840037400373731633749520200200200002005000040037400371120201100991002000010000000013104162239909100100001004003840038400384003840038
20204400373000100006139822100202002002000020020000110528538804001840037400373731633749520200200200002045000040037400371120201100991002000010000200013102162239909100100001004003840038400384003840038
2020440037300000000613982225202002002000020020000110028538804001840037400373731633749520200200200002005000040037402251120201100991002000010000030013102162239909100100001004003840038400384003840038
2020440037300000000613982225202002002000020020000110028538804001840037400373731633749520200200200002005000040037400371120201100991002000010000023013102162239909100100001004003840038400384003840038
202044003730001000010339822252020020020000200200001100285388040018400374003737316183749520200200200002005000040037400371120201100991002000010000000013102162239909100100001004003840038400384003840038
2020440037299000000613982225202002002000020020000110028538804001840037400373731633749520200200200002005000040037400371120201100991002000010000000013102162239909100100001004003840038400384003840038
2020440037299000000613982225202002002000020020000110028538804001840037400373731633749520200200200002005000040037400371120201100991002000010000000013102162239909100100001004003840038400384003840038
20204400373000000004413982225202002002000020020000110028538804001840037400373731633749520200200200002005000040037400371120201100991002000010000000013102162239909100100001004003840038400384003840038
2020440037300000000613982225202002002000020020000110028538804001840037400373731633749520200200200002005000040037400371120201100991002000010000000013102162239909100100001004003840038400384003840038
2020440037300000000943982225202002002000020020000110028538804001840037400373731633749520200200200002005000040037400371120201100991002000010000000013102162239909100100001004003840038400384003840038

1000 unrolls and 10 iterations

Result (median cycles for code, minus 2 chain cycles): 2.0037

retire (01)cycle (02)0307080a0b18191e1f3a3f4e51inst 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 integer (97)inst neon or fp (9a)9fa0a1a6a7a8a9acc2cdcfd5d6d8ddinst fetch restart (de)e0? int output thing (e9)? fp/simd (ee)gpr retires (ef)f5f6f7f8fd
20024400372990010009008939822252002020200122020000110285388014001840037400373733833751720020202000020500004003740037112002110910200001000000000030012709160109399091010000104003840038400384003840038
2002440037300000000120061398222520020202000020200001092854371140018400374003737338337517200202020000205000040037400371120021109102000010000000000000127011412081011399091010000104032340038403234003840132
20024400373000000001442640613982225200202020000202000011028538801400184027440037373383037517200202020000205164140037403681120021109102000010000000000000138614160910399091110000104003840278400384027540038
200244003730200000000061398222520020202000020200001102853880140018402264003737338253751720020202000020500004003740037112002110910200001000020000453934013229160119399091010000104003840038400384003840038
200244003730000000000061398222520096202000020202401102854371140018401324003737338737517200202020000205000040037400371120021109102000010000600000000127081601111400521010000104032240038400384036940038
200244003730000000000017903982225201042020036202055811028538801401624003740037373383375172002020200002050227400374003711200211091020000100000000000001270101601110399091010000104003840038400384003840038
200244003730000013140500613982225200202020000202000011028538800400184031840037374133037517205802020000205000040180401321120021109102000010000002000000127012160810399451010000104003840038400384003840038
200244003730001400013200613971462200202020000202000011028573170400184032340037374202037545204202020000205000040037400371120021109102000010000000000000127012160108399091010000104003840038400854003840038
2002440037300010002035201425398222520020202007220205601102853880140270400374032137338337517200202020000205070840131400371120021109102000010000000002000127081601011399091010000104032140038400384008440038
20024400373000010000006139822252002020200002020000108285388014001840037400373735033751720180202000020500004003740037112002110910200001000000001000012709160810399091010000104003840038400384003840038

Test 5: throughput

Count: 8

Code:

  fcsel s0, s8, s9, lt
  fcsel s1, s8, s9, lt
  fcsel s2, s8, s9, lt
  fcsel s3, s8, s9, lt
  fcsel s4, s8, s9, lt
  fcsel s5, s8, s9, lt
  fcsel s6, s8, s9, lt
  fcsel s7, s8, s9, lt
  movi v8.16b, 9
  movi v9.16b, 10

(fused SUBS/B.cc loop)

100 unrolls and 100 iterations

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

retire (01)cycle (02)031e3f51inst 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)9fa0a1a6a8accdcfd5d6ddinst fetch restart (de)e0? fp/simd (ee)gpr retires (ef)f5f6f7f8fd
80204400503000432580100100800001008000050064000014001940038400382997032999680100200800002002400004003840038118020110099100100800008010000000051102161140035800001004003940039400394003940039
80204400382990432580100100800001008000050064000004001940038400382997032999680100200800002002400004003840038118020110099100100800008010000000051101161140035800001004003940039400394003940039
80204400383000432580100100800001008000050064000004016940038400382997032999680100200800002002400004003840038118020110099100100800008010000000051101161140035800001004003940039400394003940039
80204400382990432580100100800001008000050064000004001940038400382997032999680100200800002002400004003840038118020110099100100800008010000000051101161140035800001004003940039400394003940039
802044003830001382580100100800001008000050064000014001940038400382997032999680100200800002002400004003840038118020110099100100800008010000000051101161140035800001004003940039400394003940039
80204400383000432580100100800001008000050064000004001940038400382997032999680100200800002002400004003840038118020110099100100800008010000000051101161140035800001004003940039400394003940039
80204400383000432580100100800001008000050064000004001940038400382997032999680100200800002002400004003840038118020110099100100800008010000000051101161140035800001004003940039400394003940039
80204400383000432580100100800001008000050064000004001940038400382997032999680100200800002002400004003840038118020110099100100800008010000000051101161140035800001004003940039400394003940039
80204400383000432580100100800001008000050064000004001940038400382997032999680100200800002002400004003840038118020110099100100800008010000000051101161140035800001004003940039400394003940039
80204400383000432580100100800001008000050064000004001940038400382997032999680100200800002002400004003840038218020110099100100800008010000000051101161140035800001004003940039400394003940039

1000 unrolls and 10 iterations

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

retire (01)cycle (02)030708191e1f3a3f51inst 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)9fa8accfd2icache miss (d3)d5d6ddinst fetch restart (de)e0? fp/simd (ee)gpr retires (ef)f5f6f7f8fd
800244004430000000043258001010800001080000506400001400194003840038299923300188001020800002024000040038400381180021109101080000800100050200018161294003580000104003940039400394003940039
800244003830000000043258001010800001080000506408731400194003840038299923300188001020800002024000040038400381180021109101080000800106050200091613144003580000104003940039400394003940039
800244003829900000043258001010800001080000506400001400194003840038299923300188001020800002024000040038400381180021109101080000800100050200013169124003580000104003940039400394003940039
80024400383000000004325800101080000108000050640000140019400384003829992330018800102080000202400004003840038118002110910108000080010005020008161294003580000104003940039400394003940039
8002440038300000000432580010108000010800005064000014001940038400382999233001880010208000020240000400384003811800211091010800008001000502000131613134003580000104003940039400394003940039
800244003829900000043258001010800001080000506400001400194003840038299923300188001020800002024000040038400381180021109101080000800100050200013161284003580000104003940039400394003940039
800244003830000000043258001010800001080000506400001400194003840038299923300188001020800002024000040038400381180021109101080000800100050200213161294003580000104003940039400394003940138
800244013530001031219204325800101080000108000056640000140094401334013630026330018800102080000202400004003840038118002110910108000080010005020009161884003580000104003940039400394003940039
80024400383000010007082580010108000010800006064039014001940038400382999233001880010208000020240000400384003811800211091010800008001000502000131613144003580000104003940039400394003940039
800244003830000000043258001010800001080000506400001400194003840038299923300188001020800002024000040038400381180021109101080000800100050200013161394003580000104003940039400394003940039