1; RUN: llvm-mc -triple arm64-apple-darwin -mattr=neon -show-encoding -output-asm-variant=1 < %s | FileCheck %s 2 3foo: 4;----------------------------------------------------------------------------- 5; Floating-point arithmetic 6;----------------------------------------------------------------------------- 7 8 fabs s1, s2 9 fabs d1, d2 10 11; CHECK: fabs s1, s2 ; encoding: [0x41,0xc0,0x20,0x1e] 12; CHECK: fabs d1, d2 ; encoding: [0x41,0xc0,0x60,0x1e] 13 14 fadd s1, s2, s3 15 fadd d1, d2, d3 16 17; CHECK: fadd s1, s2, s3 ; encoding: [0x41,0x28,0x23,0x1e] 18; CHECK: fadd d1, d2, d3 ; encoding: [0x41,0x28,0x63,0x1e] 19 20 fdiv s1, s2, s3 21 fdiv d1, d2, d3 22 23; CHECK: fdiv s1, s2, s3 ; encoding: [0x41,0x18,0x23,0x1e] 24; CHECK: fdiv d1, d2, d3 ; encoding: [0x41,0x18,0x63,0x1e] 25 26 fmadd s1, s2, s3, s4 27 fmadd d1, d2, d3, d4 28 29; CHECK: fmadd s1, s2, s3, s4 ; encoding: [0x41,0x10,0x03,0x1f] 30; CHECK: fmadd d1, d2, d3, d4 ; encoding: [0x41,0x10,0x43,0x1f] 31 32 fmax s1, s2, s3 33 fmax d1, d2, d3 34 fmaxnm s1, s2, s3 35 fmaxnm d1, d2, d3 36 37; CHECK: fmax s1, s2, s3 ; encoding: [0x41,0x48,0x23,0x1e] 38; CHECK: fmax d1, d2, d3 ; encoding: [0x41,0x48,0x63,0x1e] 39; CHECK: fmaxnm s1, s2, s3 ; encoding: [0x41,0x68,0x23,0x1e] 40; CHECK: fmaxnm d1, d2, d3 ; encoding: [0x41,0x68,0x63,0x1e] 41 42 fmin s1, s2, s3 43 fmin d1, d2, d3 44 fminnm s1, s2, s3 45 fminnm d1, d2, d3 46 47; CHECK: fmin s1, s2, s3 ; encoding: [0x41,0x58,0x23,0x1e] 48; CHECK: fmin d1, d2, d3 ; encoding: [0x41,0x58,0x63,0x1e] 49; CHECK: fminnm s1, s2, s3 ; encoding: [0x41,0x78,0x23,0x1e] 50; CHECK: fminnm d1, d2, d3 ; encoding: [0x41,0x78,0x63,0x1e] 51 52 fmsub s1, s2, s3, s4 53 fmsub d1, d2, d3, d4 54 55; CHECK: fmsub s1, s2, s3, s4 ; encoding: [0x41,0x90,0x03,0x1f] 56; CHECK: fmsub d1, d2, d3, d4 ; encoding: [0x41,0x90,0x43,0x1f] 57 58 fmul s1, s2, s3 59 fmul d1, d2, d3 60 61; CHECK: fmul s1, s2, s3 ; encoding: [0x41,0x08,0x23,0x1e] 62; CHECK: fmul d1, d2, d3 ; encoding: [0x41,0x08,0x63,0x1e] 63 64 fneg s1, s2 65 fneg d1, d2 66 67; CHECK: fneg s1, s2 ; encoding: [0x41,0x40,0x21,0x1e] 68; CHECK: fneg d1, d2 ; encoding: [0x41,0x40,0x61,0x1e] 69 70 fnmadd s1, s2, s3, s4 71 fnmadd d1, d2, d3, d4 72 73; CHECK: fnmadd s1, s2, s3, s4 ; encoding: [0x41,0x10,0x23,0x1f] 74; CHECK: fnmadd d1, d2, d3, d4 ; encoding: [0x41,0x10,0x63,0x1f] 75 76 fnmsub s1, s2, s3, s4 77 fnmsub d1, d2, d3, d4 78 79; CHECK: fnmsub s1, s2, s3, s4 ; encoding: [0x41,0x90,0x23,0x1f] 80; CHECK: fnmsub d1, d2, d3, d4 ; encoding: [0x41,0x90,0x63,0x1f] 81 82 fnmul s1, s2, s3 83 fnmul d1, d2, d3 84 85; CHECK: fnmul s1, s2, s3 ; encoding: [0x41,0x88,0x23,0x1e] 86; CHECK: fnmul d1, d2, d3 ; encoding: [0x41,0x88,0x63,0x1e] 87 88 fsqrt s1, s2 89 fsqrt d1, d2 90 91; CHECK: fsqrt s1, s2 ; encoding: [0x41,0xc0,0x21,0x1e] 92; CHECK: fsqrt d1, d2 ; encoding: [0x41,0xc0,0x61,0x1e] 93 94 fsub s1, s2, s3 95 fsub d1, d2, d3 96 97; CHECK: fsub s1, s2, s3 ; encoding: [0x41,0x38,0x23,0x1e] 98; CHECK: fsub d1, d2, d3 ; encoding: [0x41,0x38,0x63,0x1e] 99 100;----------------------------------------------------------------------------- 101; Floating-point comparison 102;----------------------------------------------------------------------------- 103 104 fccmp s1, s2, #0, eq 105 fccmp d1, d2, #0, eq 106 fccmpe s1, s2, #0, eq 107 fccmpe d1, d2, #0, eq 108 109; CHECK: fccmp s1, s2, #0, eq ; encoding: [0x20,0x04,0x22,0x1e] 110; CHECK: fccmp d1, d2, #0, eq ; encoding: [0x20,0x04,0x62,0x1e] 111; CHECK: fccmpe s1, s2, #0, eq ; encoding: [0x30,0x04,0x22,0x1e] 112; CHECK: fccmpe d1, d2, #0, eq ; encoding: [0x30,0x04,0x62,0x1e] 113 114 fcmp s1, s2 115 fcmp d1, d2 116 fcmp s1, #0.0 117 fcmp d1, #0.0 118 fcmpe s1, s2 119 fcmpe d1, d2 120 fcmpe s1, #0.0 121 fcmpe d1, #0.0 122 123; CHECK: fcmp s1, s2 ; encoding: [0x20,0x20,0x22,0x1e] 124; CHECK: fcmp d1, d2 ; encoding: [0x20,0x20,0x62,0x1e] 125; CHECK: fcmp s1, #0.0 ; encoding: [0x28,0x20,0x20,0x1e] 126; CHECK: fcmp d1, #0.0 ; encoding: [0x28,0x20,0x60,0x1e] 127; CHECK: fcmpe s1, s2 ; encoding: [0x30,0x20,0x22,0x1e] 128; CHECK: fcmpe d1, d2 ; encoding: [0x30,0x20,0x62,0x1e] 129; CHECK: fcmpe s1, #0.0 ; encoding: [0x38,0x20,0x20,0x1e] 130; CHECK: fcmpe d1, #0.0 ; encoding: [0x38,0x20,0x60,0x1e] 131 132;----------------------------------------------------------------------------- 133; Floating-point conditional select 134;----------------------------------------------------------------------------- 135 136 fcsel s1, s2, s3, eq 137 fcsel d1, d2, d3, eq 138 139; CHECK: fcsel s1, s2, s3, eq ; encoding: [0x41,0x0c,0x23,0x1e] 140; CHECK: fcsel d1, d2, d3, eq ; encoding: [0x41,0x0c,0x63,0x1e] 141 142;----------------------------------------------------------------------------- 143; Floating-point convert 144;----------------------------------------------------------------------------- 145 146 fcvt h1, d2 147 fcvt s1, d2 148 fcvt d1, h2 149 fcvt s1, h2 150 fcvt d1, s2 151 fcvt h1, s2 152 153; CHECK: fcvt h1, d2 ; encoding: [0x41,0xc0,0x63,0x1e] 154; CHECK: fcvt s1, d2 ; encoding: [0x41,0x40,0x62,0x1e] 155; CHECK: fcvt d1, h2 ; encoding: [0x41,0xc0,0xe2,0x1e] 156; CHECK: fcvt s1, h2 ; encoding: [0x41,0x40,0xe2,0x1e] 157; CHECK: fcvt d1, s2 ; encoding: [0x41,0xc0,0x22,0x1e] 158; CHECK: fcvt h1, s2 ; encoding: [0x41,0xc0,0x23,0x1e] 159 160 fcvtas w1, d2 161 fcvtas x1, d2 162 fcvtas w1, s2 163 fcvtas x1, s2 164 165; CHECK: fcvtas w1, d2 ; encoding: [0x41,0x00,0x64,0x1e] 166; CHECK: fcvtas x1, d2 ; encoding: [0x41,0x00,0x64,0x9e] 167; CHECK: fcvtas w1, s2 ; encoding: [0x41,0x00,0x24,0x1e] 168; CHECK: fcvtas x1, s2 ; encoding: [0x41,0x00,0x24,0x9e] 169 170 fcvtau w1, s2 171 fcvtau w1, d2 172 fcvtau x1, s2 173 fcvtau x1, d2 174 175; CHECK: fcvtau w1, s2 ; encoding: [0x41,0x00,0x25,0x1e] 176; CHECK: fcvtau w1, d2 ; encoding: [0x41,0x00,0x65,0x1e] 177; CHECK: fcvtau x1, s2 ; encoding: [0x41,0x00,0x25,0x9e] 178; CHECK: fcvtau x1, d2 ; encoding: [0x41,0x00,0x65,0x9e] 179 180 fcvtms w1, s2 181 fcvtms w1, d2 182 fcvtms x1, s2 183 fcvtms x1, d2 184 185; CHECK: fcvtms w1, s2 ; encoding: [0x41,0x00,0x30,0x1e] 186; CHECK: fcvtms w1, d2 ; encoding: [0x41,0x00,0x70,0x1e] 187; CHECK: fcvtms x1, s2 ; encoding: [0x41,0x00,0x30,0x9e] 188; CHECK: fcvtms x1, d2 ; encoding: [0x41,0x00,0x70,0x9e] 189 190 fcvtmu w1, s2 191 fcvtmu w1, d2 192 fcvtmu x1, s2 193 fcvtmu x1, d2 194 195; CHECK: fcvtmu w1, s2 ; encoding: [0x41,0x00,0x31,0x1e] 196; CHECK: fcvtmu w1, d2 ; encoding: [0x41,0x00,0x71,0x1e] 197; CHECK: fcvtmu x1, s2 ; encoding: [0x41,0x00,0x31,0x9e] 198; CHECK: fcvtmu x1, d2 ; encoding: [0x41,0x00,0x71,0x9e] 199 200 fcvtns w1, s2 201 fcvtns w1, d2 202 fcvtns x1, s2 203 fcvtns x1, d2 204 205; CHECK: fcvtns w1, s2 ; encoding: [0x41,0x00,0x20,0x1e] 206; CHECK: fcvtns w1, d2 ; encoding: [0x41,0x00,0x60,0x1e] 207; CHECK: fcvtns x1, s2 ; encoding: [0x41,0x00,0x20,0x9e] 208; CHECK: fcvtns x1, d2 ; encoding: [0x41,0x00,0x60,0x9e] 209 210 fcvtnu w1, s2 211 fcvtnu w1, d2 212 fcvtnu x1, s2 213 fcvtnu x1, d2 214 215; CHECK: fcvtnu w1, s2 ; encoding: [0x41,0x00,0x21,0x1e] 216; CHECK: fcvtnu w1, d2 ; encoding: [0x41,0x00,0x61,0x1e] 217; CHECK: fcvtnu x1, s2 ; encoding: [0x41,0x00,0x21,0x9e] 218; CHECK: fcvtnu x1, d2 ; encoding: [0x41,0x00,0x61,0x9e] 219 220 fcvtps w1, s2 221 fcvtps w1, d2 222 fcvtps x1, s2 223 fcvtps x1, d2 224 225; CHECK: fcvtps w1, s2 ; encoding: [0x41,0x00,0x28,0x1e] 226; CHECK: fcvtps w1, d2 ; encoding: [0x41,0x00,0x68,0x1e] 227; CHECK: fcvtps x1, s2 ; encoding: [0x41,0x00,0x28,0x9e] 228; CHECK: fcvtps x1, d2 ; encoding: [0x41,0x00,0x68,0x9e] 229 230 fcvtpu w1, s2 231 fcvtpu w1, d2 232 fcvtpu x1, s2 233 fcvtpu x1, d2 234 235; CHECK: fcvtpu w1, s2 ; encoding: [0x41,0x00,0x29,0x1e] 236; CHECK: fcvtpu w1, d2 ; encoding: [0x41,0x00,0x69,0x1e] 237; CHECK: fcvtpu x1, s2 ; encoding: [0x41,0x00,0x29,0x9e] 238; CHECK: fcvtpu x1, d2 ; encoding: [0x41,0x00,0x69,0x9e] 239 240 fcvtzs w1, s2 241 fcvtzs w1, s2, #1 242 fcvtzs w1, d2 243 fcvtzs w1, d2, #1 244 fcvtzs x1, s2 245 fcvtzs x1, s2, #1 246 fcvtzs x1, d2 247 fcvtzs x1, d2, #1 248 249; CHECK: fcvtzs w1, s2 ; encoding: [0x41,0x00,0x38,0x1e] 250; CHECK: fcvtzs w1, s2, #1 ; encoding: [0x41,0xfc,0x18,0x1e] 251; CHECK: fcvtzs w1, d2 ; encoding: [0x41,0x00,0x78,0x1e] 252; CHECK: fcvtzs w1, d2, #1 ; encoding: [0x41,0xfc,0x58,0x1e] 253; CHECK: fcvtzs x1, s2 ; encoding: [0x41,0x00,0x38,0x9e] 254; CHECK: fcvtzs x1, s2, #1 ; encoding: [0x41,0xfc,0x18,0x9e] 255; CHECK: fcvtzs x1, d2 ; encoding: [0x41,0x00,0x78,0x9e] 256; CHECK: fcvtzs x1, d2, #1 ; encoding: [0x41,0xfc,0x58,0x9e] 257 258 fcvtzu w1, s2 259 fcvtzu w1, s2, #1 260 fcvtzu w1, d2 261 fcvtzu w1, d2, #1 262 fcvtzu x1, s2 263 fcvtzu x1, s2, #1 264 fcvtzu x1, d2 265 fcvtzu x1, d2, #1 266 267; CHECK: fcvtzu w1, s2 ; encoding: [0x41,0x00,0x39,0x1e] 268; CHECK: fcvtzu w1, s2, #1 ; encoding: [0x41,0xfc,0x19,0x1e] 269; CHECK: fcvtzu w1, d2 ; encoding: [0x41,0x00,0x79,0x1e] 270; CHECK: fcvtzu w1, d2, #1 ; encoding: [0x41,0xfc,0x59,0x1e] 271; CHECK: fcvtzu x1, s2 ; encoding: [0x41,0x00,0x39,0x9e] 272; CHECK: fcvtzu x1, s2, #1 ; encoding: [0x41,0xfc,0x19,0x9e] 273; CHECK: fcvtzu x1, d2 ; encoding: [0x41,0x00,0x79,0x9e] 274; CHECK: fcvtzu x1, d2, #1 ; encoding: [0x41,0xfc,0x59,0x9e] 275 276 scvtf s1, w2 277 scvtf s1, w2, #1 278 scvtf d1, w2 279 scvtf d1, w2, #1 280 scvtf s1, x2 281 scvtf s1, x2, #1 282 scvtf d1, x2 283 scvtf d1, x2, #1 284 285; CHECK: scvtf s1, w2 ; encoding: [0x41,0x00,0x22,0x1e] 286; CHECK: scvtf s1, w2, #1 ; encoding: [0x41,0xfc,0x02,0x1e] 287; CHECK: scvtf d1, w2 ; encoding: [0x41,0x00,0x62,0x1e] 288; CHECK: scvtf d1, w2, #1 ; encoding: [0x41,0xfc,0x42,0x1e] 289; CHECK: scvtf s1, x2 ; encoding: [0x41,0x00,0x22,0x9e] 290; CHECK: scvtf s1, x2, #1 ; encoding: [0x41,0xfc,0x02,0x9e] 291; CHECK: scvtf d1, x2 ; encoding: [0x41,0x00,0x62,0x9e] 292; CHECK: scvtf d1, x2, #1 ; encoding: [0x41,0xfc,0x42,0x9e] 293 294 ucvtf s1, w2 295 ucvtf s1, w2, #1 296 ucvtf d1, w2 297 ucvtf d1, w2, #1 298 ucvtf s1, x2 299 ucvtf s1, x2, #1 300 ucvtf d1, x2 301 ucvtf d1, x2, #1 302 303; CHECK: ucvtf s1, w2 ; encoding: [0x41,0x00,0x23,0x1e] 304; CHECK: ucvtf s1, w2, #1 ; encoding: [0x41,0xfc,0x03,0x1e] 305; CHECK: ucvtf d1, w2 ; encoding: [0x41,0x00,0x63,0x1e] 306; CHECK: ucvtf d1, w2, #1 ; encoding: [0x41,0xfc,0x43,0x1e] 307; CHECK: ucvtf s1, x2 ; encoding: [0x41,0x00,0x23,0x9e] 308; CHECK: ucvtf s1, x2, #1 ; encoding: [0x41,0xfc,0x03,0x9e] 309; CHECK: ucvtf d1, x2 ; encoding: [0x41,0x00,0x63,0x9e] 310; CHECK: ucvtf d1, x2, #1 ; encoding: [0x41,0xfc,0x43,0x9e] 311 312;----------------------------------------------------------------------------- 313; Floating-point move 314;----------------------------------------------------------------------------- 315 316 fmov s1, w2 317 fmov w1, s2 318 fmov d1, x2 319 fmov x1, d2 320 321; CHECK: fmov s1, w2 ; encoding: [0x41,0x00,0x27,0x1e] 322; CHECK: fmov w1, s2 ; encoding: [0x41,0x00,0x26,0x1e] 323; CHECK: fmov d1, x2 ; encoding: [0x41,0x00,0x67,0x9e] 324; CHECK: fmov x1, d2 ; encoding: [0x41,0x00,0x66,0x9e] 325 326 fmov s1, #0.125 327 fmov s1, #0x40 328 fmov d1, #0.125 329 fmov d1, #0x40 330 fmov d1, #-4.843750e-01 331 fmov d1, #4.843750e-01 332 fmov d3, #3 333 fmov s2, #0.0 334 fmov d2, #0.0 335 336; CHECK: fmov s1, #0.12500000 ; encoding: [0x01,0x10,0x28,0x1e] 337; CHECK: fmov s1, #0.12500000 ; encoding: [0x01,0x10,0x28,0x1e] 338; CHECK: fmov d1, #0.12500000 ; encoding: [0x01,0x10,0x68,0x1e] 339; CHECK: fmov d1, #0.12500000 ; encoding: [0x01,0x10,0x68,0x1e] 340; CHECK: fmov d1, #-0.48437500 ; encoding: [0x01,0xf0,0x7b,0x1e] 341; CHECK: fmov d1, #0.48437500 ; encoding: [0x01,0xf0,0x6b,0x1e] 342; CHECK: fmov d3, #3.00000000 ; encoding: [0x03,0x10,0x61,0x1e] 343; CHECK: fmov s2, wzr ; encoding: [0xe2,0x03,0x27,0x1e] 344; CHECK: fmov d2, xzr ; encoding: [0xe2,0x03,0x67,0x9e] 345 346 fmov s1, s2 347 fmov d1, d2 348 349; CHECK: fmov s1, s2 ; encoding: [0x41,0x40,0x20,0x1e] 350; CHECK: fmov d1, d2 ; encoding: [0x41,0x40,0x60,0x1e] 351 352 353 fmov x2, v5.d[1] 354 fmov.d x9, v7[1] 355 fmov v1.d[1], x1 356 fmov.d v8[1], x6 357 358; CHECK: fmov.d x2, v5[1] ; encoding: [0xa2,0x00,0xae,0x9e] 359; CHECK: fmov.d x9, v7[1] ; encoding: [0xe9,0x00,0xae,0x9e] 360; CHECK: fmov.d v1[1], x1 ; encoding: [0x21,0x00,0xaf,0x9e] 361; CHECK: fmov.d v8[1], x6 ; encoding: [0xc8,0x00,0xaf,0x9e] 362 363 364;----------------------------------------------------------------------------- 365; Floating-point round to integral 366;----------------------------------------------------------------------------- 367 368 frinta s1, s2 369 frinta d1, d2 370 371; CHECK: frinta s1, s2 ; encoding: [0x41,0x40,0x26,0x1e] 372; CHECK: frinta d1, d2 ; encoding: [0x41,0x40,0x66,0x1e] 373 374 frinti s1, s2 375 frinti d1, d2 376 377; CHECK: frinti s1, s2 ; encoding: [0x41,0xc0,0x27,0x1e] 378; CHECK: frinti d1, d2 ; encoding: [0x41,0xc0,0x67,0x1e] 379 380 frintm s1, s2 381 frintm d1, d2 382 383; CHECK: frintm s1, s2 ; encoding: [0x41,0x40,0x25,0x1e] 384; CHECK: frintm d1, d2 ; encoding: [0x41,0x40,0x65,0x1e] 385 386 frintn s1, s2 387 frintn d1, d2 388 389; CHECK: frintn s1, s2 ; encoding: [0x41,0x40,0x24,0x1e] 390; CHECK: frintn d1, d2 ; encoding: [0x41,0x40,0x64,0x1e] 391 392 frintp s1, s2 393 frintp d1, d2 394 395; CHECK: frintp s1, s2 ; encoding: [0x41,0xc0,0x24,0x1e] 396; CHECK: frintp d1, d2 ; encoding: [0x41,0xc0,0x64,0x1e] 397 398 frintx s1, s2 399 frintx d1, d2 400 401; CHECK: frintx s1, s2 ; encoding: [0x41,0x40,0x27,0x1e] 402; CHECK: frintx d1, d2 ; encoding: [0x41,0x40,0x67,0x1e] 403 404 frintz s1, s2 405 frintz d1, d2 406 407; CHECK: frintz s1, s2 ; encoding: [0x41,0xc0,0x25,0x1e] 408; CHECK: frintz d1, d2 ; encoding: [0x41,0xc0,0x65,0x1e] 409 410 cmhs d0, d0, d0 411 cmtst d0, d0, d0 412 413; CHECK: cmhs d0, d0, d0 ; encoding: [0x00,0x3c,0xe0,0x7e] 414; CHECK: cmtst d0, d0, d0 ; encoding: [0x00,0x8c,0xe0,0x5e] 415 416 417 418;----------------------------------------------------------------------------- 419; Floating-point extract and narrow 420;----------------------------------------------------------------------------- 421 sqxtn b4, h2 422 sqxtn h2, s3 423 sqxtn s9, d2 424 425; CHECK: sqxtn b4, h2 ; encoding: [0x44,0x48,0x21,0x5e] 426; CHECK: sqxtn h2, s3 ; encoding: [0x62,0x48,0x61,0x5e] 427; CHECK: sqxtn s9, d2 ; encoding: [0x49,0x48,0xa1,0x5e] 428 429 sqxtun b4, h2 430 sqxtun h2, s3 431 sqxtun s9, d2 432 433; CHECK: sqxtun b4, h2 ; encoding: [0x44,0x28,0x21,0x7e] 434; CHECK: sqxtun h2, s3 ; encoding: [0x62,0x28,0x61,0x7e] 435; CHECK: sqxtun s9, d2 ; encoding: [0x49,0x28,0xa1,0x7e] 436 437 uqxtn b4, h2 438 uqxtn h2, s3 439 uqxtn s9, d2 440 441; CHECK: uqxtn b4, h2 ; encoding: [0x44,0x48,0x21,0x7e] 442; CHECK: uqxtn h2, s3 ; encoding: [0x62,0x48,0x61,0x7e] 443; CHECK: uqxtn s9, d2 ; encoding: [0x49,0x48,0xa1,0x7e] 444