Files
swift-mirror/test/IRGen/multi_payload_shifting.swift
Anthony Latsis 17fc00f8a7 [test] IRGen: Adjust FileCheck patterns for new nuw attribute in upstream LLVM
This attribute was introduced in
7eca38ce76d5d1915f4ab7e665964062c0b37697 (llvm-project).

Match it using a wildcard regex, since it is not relevant to these
tests.

This is intended to reduce future conflicts with rebranch.
2025-05-04 03:28:56 +01:00

33 lines
813 B
Swift

// RUN: %target-swift-frontend -enable-objc-interop -primary-file %s -emit-ir | %FileCheck %s
// REQUIRES: CPU=x86_64
class Tag {}
struct Scalar {
var str = ""
var x = Tag()
var style: BinaryChoice = .zero
enum BinaryChoice: UInt32 {
case zero = 0
case one
}
}
public struct Sequence {
var tag: Tag = Tag()
var tag2: Tag = Tag()
}
enum Node {
case scalar(Scalar)
case sequence(Sequence)
}
// CHECK: define internal i32 @"$s22multi_payload_shifting4NodeOwet"(ptr noalias %value, i32 %numEmptyCases, ptr %Node)
// CHECK: [[ADDR:%.*]] = getelementptr inbounds{{.*}} { i64, i64, i64, i8 }, ptr {{.*}}, i32 0, i32 3
// CHECK: [[BYTE:%.*]] = load i8, ptr [[ADDR]]
// Make sure we zext before we shift.
// CHECK: [[ZEXT:%.*]] = zext i8 [[BYTE]] to i32
// CHECK: shl i32 [[ZEXT]], 10